fixes #1479
This commit is contained in:
@@ -35,6 +35,6 @@ class TagsController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
def check_privilege(tag)
|
def check_privilege(tag)
|
||||||
raise User::PrivilegeError unless (CurrentUser.is_builder? || tag.post_count <= 50)
|
raise User::PrivilegeError unless tag.editable_by?(CurrentUser.user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -561,6 +561,10 @@ class Tag < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def editable_by?(user)
|
||||||
|
user.is_builder? || (user.is_member? && post_count <= 50)
|
||||||
|
end
|
||||||
|
|
||||||
include ApiMethods
|
include ApiMethods
|
||||||
include CountMethods
|
include CountMethods
|
||||||
extend ViewCountMethods
|
extend ViewCountMethods
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<%= link_to(tag.name, posts_path(:tags => tag.name)) %>
|
<%= link_to(tag.name, posts_path(:tags => tag.name)) %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<% if CurrentUser.is_builder? || tag.post_count <= 50 %>
|
<% if tag.editable_by?(CurrentUser.user) %>
|
||||||
<%= link_to "edit", edit_tag_path(tag) %>
|
<%= link_to "edit", edit_tag_path(tag) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if CurrentUser.is_builder? && tag.post_count < 1_000 %>
|
<% if CurrentUser.is_builder? && tag.post_count < 1_000 %>
|
||||||
|
|||||||
Reference in New Issue
Block a user