take suggestions on moderator stories, just not those with privileged tags

also allow moderators to make tag suggestions, we're people too
This commit is contained in:
joshua stein 2015-10-17 10:38:48 -05:00
parent 1d30378877
commit a337ee850e
2 changed files with 13 additions and 8 deletions

View file

@ -209,15 +209,19 @@ class Story < ActiveRecord::Base
end
def can_have_suggestions_from_user?(user)
if user
if self.user.is_moderator?
return false
end
return true
else
if !user
return false
end
if user.id == self.user_id
return false
end
if self.tags.select{|t| t.privileged? }.any?
return false
end
return true
end
# this has to happen just before save rather than in tags_a= because we need

View file

@ -127,7 +127,8 @@ class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %>
:confirm => "Are you sure you want to delete this story?" } %>
<% end %>
<% end %>
<% elsif story.can_have_suggestions_from_user?(@user) %>
<% end %>
<% if story.can_have_suggestions_from_user?(@user) %>
| <%= link_to "suggest", story_suggest_path(story.short_id),
:class => "suggester" %>
<% end %>