summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMrYummy <elemental428@gmail.com>2017-06-18 22:44:03 +0200
committerMrYummy <elemental428@gmail.com>2017-06-18 22:44:03 +0200
commitbcc1f192f5e4a3af5f0bd5384c21101fbeed8674 (patch)
tree0f665eaa5c867d8d9a69397dbc990edd7998d967
parent5e4e6583bba289f4c8cc1bd4e4da7d772a8423d9 (diff)
Added warning for replies on closed threads
-rw-r--r--app/views/threadreplies/_new.html.erb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/views/threadreplies/_new.html.erb b/app/views/threadreplies/_new.html.erb
index d1fc7d2..c22463d 100644
--- a/app/views/threadreplies/_new.html.erb
+++ b/app/views/threadreplies/_new.html.erb
@@ -2,8 +2,10 @@
<%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content} %>
<% nec_msg = "" %>
<% forum = Forum.find(reply.thread.forum_id) %>
- <% if forum.necro_length != nil %>
- <% if Threadreply.where(forumthread: reply.thread).any? %>
+ <% if forum.necro_length %>
+ <% if reply.thread.label.try(:name).try(:downcase) == "closed" %>
+ <% nec_msg = "This thread is closed. Are you sure you want to make this reply? If so, press 'Ok'" %>
+ <% elsif Threadreply.where(forumthread: reply.thread).any? %>
<% prevAgo = Threadreply.where(forumthread: reply.thread).order(:id).last.created_at %>
<% if prevAgo <= forum.necro_length.days.ago.utc %>
<% nec_msg = "You may be necroposting, as the last reply was made at least #{forum.necro_length} days ago. If you still wish to make this reply, press 'Ok'." %>