summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-06 13:27:37 +0200
committerYorhel <git@yorhel.nl>2020-08-06 13:30:20 +0200
commit7004c6deffd56b88df93a15ebf75ec593443aa4b (patch)
treef406e087deee933da51ca8c3a18cc4dabd0efbde
parent14fa9431498e7102ba772549570851839df93f4e (diff)
Discussions: Don't show deletion button when creating a new thread
Both pointless and wrong.
-rw-r--r--elm/Discussions/Edit.elm2
-rw-r--r--lib/VNWeb/Discussions/Edit.pm2
2 files changed, 2 insertions, 2 deletions
diff --git a/elm/Discussions/Edit.elm b/elm/Discussions/Edit.elm
index c825506e..9a98733b 100644
--- a/elm/Discussions/Edit.elm
+++ b/elm/Discussions/Edit.elm
@@ -240,7 +240,7 @@ view model =
]
]
++ (if thread then poll () else [])
- ++ (if not model.can_mod then [] else
+ ++ (if not model.can_mod || model.tid == Nothing then [] else
[ tr [ class "newpart" ] [ td [ colspan 2 ] [ text "DANGER ZONE" ] ]
, formField ""
[ inputCheck "" model.delete Delete
diff --git a/lib/VNWeb/Discussions/Edit.pm b/lib/VNWeb/Discussions/Edit.pm
index dda16d7e..ec1218c0 100644
--- a/lib/VNWeb/Discussions/Edit.pm
+++ b/lib/VNWeb/Discussions/Edit.pm
@@ -50,7 +50,7 @@ elm_api DiscussionsEdit => $FORM_OUT, $FORM_IN, sub {
return tuwf->resNotFound if $tid && !$t->{id};
return elm_Unauth if !can_edit t => $t;
- if($data->{delete} && auth->permBoardmod) {
+ if($tid && $data->{delete} && auth->permBoardmod) {
auth->audit($t->{user_id}, 'post delete', "deleted $tid.$num");
if($num == 1) {
tuwf->dbExeci('DELETE FROM threads WHERE id =', \$tid);