diff options
author | Yorhel <git@yorhel.nl> | 2019-12-30 15:35:46 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-12-30 15:35:46 +0100 |
commit | 8143e41a59efb8d7220da458e0a94b5b839179b2 (patch) | |
tree | 6eaa0eddf45541f2b121bf14d3aea20be16f56a1 /lib/VNWeb/Discussions/Thread.pm | |
parent | d1bb5b82255c764edecc659c78d5b9f4e36555e8 (diff) |
Discussions: Discourage necroing old and inactive threads
Diffstat (limited to 'lib/VNWeb/Discussions/Thread.pm')
-rw-r--r-- | lib/VNWeb/Discussions/Thread.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/VNWeb/Discussions/Thread.pm b/lib/VNWeb/Discussions/Thread.pm index a5aeb8bd..7132f099 100644 --- a/lib/VNWeb/Discussions/Thread.pm +++ b/lib/VNWeb/Discussions/Thread.pm @@ -30,12 +30,16 @@ elm_form 'DiscussionsPoll' => $POLL_OUT, $POLL_IN; -my $REPLY_IN = form_compile any => { +my $REPLY = { tid => { id => 1 }, - msg => { maxlength => 32768 } + old => { _when => 'out', anybool => 1 }, + msg => { _when => 'in', maxlength => 32768 } }; -elm_form 'DiscussionsReply' => undef, $REPLY_IN; +my $REPLY_IN = form_compile in => $REPLY; +my $REPLY_OUT = form_compile out => $REPLY; + +elm_form 'DiscussionsReply' => $REPLY_OUT, $REPLY_IN; @@ -103,10 +107,10 @@ sub posts_ { sub reply_ { - my($t, $page) = @_; + my($t, $posts, $page) = @_; return if $t->{count} > $page*25; if(can_edit t => $t) { - elm_ 'Discussions.Reply' => undef, $t->{id}*1; + elm_ 'Discussions.Reply' => $REPLY_OUT, { tid => $t->{id}, old => $posts->[$#$posts]{date} < time-182*24*3600 }; } else { div_ class => 'mainbox', sub { h1_ 'Reply'; @@ -164,7 +168,7 @@ TUWF::get qr{/$RE{tid}(?:/$RE{num})?}, sub { options => $poll_options } if $t->{poll_question}; posts_ $t, $posts, $page; - reply_ $t, $page; + reply_ $t, $posts, $page; } }; |