fixes #1406
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
class TagsController < ApplicationController
|
class TagsController < ApplicationController
|
||||||
before_filter :builder_only, :only => [:edit, :update]
|
before_filter :member_only, :only => [:edit, :update]
|
||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@tag = Tag.find(params[:id])
|
@tag = Tag.find(params[:id])
|
||||||
|
check_privilege(@tag)
|
||||||
respond_with(@tag)
|
respond_with(@tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -26,8 +27,14 @@ class TagsController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@tag = Tag.find(params[:id])
|
@tag = Tag.find(params[:id])
|
||||||
|
check_privilege(@tag)
|
||||||
@tag.update_attributes(params[:tag])
|
@tag.update_attributes(params[:tag])
|
||||||
@tag.update_category_cache_for_all
|
@tag.update_category_cache_for_all
|
||||||
respond_with(@tag)
|
respond_with(@tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def check_privilege(tag)
|
||||||
|
raise User::PrivilegeError unless (CurrentUser.is_builder? || tag.post_count <= 50)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
<%= 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? %>
|
<% if CurrentUser.is_builder? || tag.post_count <= 50 %>
|
||||||
<%= link_to "edit", edit_tag_path(tag) %>
|
<%= link_to "edit", edit_tag_path(tag) %>
|
||||||
<% if tag.post_count < 1_000 %>
|
<% end %>
|
||||||
| <%= link_to "fix", new_tag_correction_path(:tag_id => tag.id) %>
|
<% if CurrentUser.is_builder? && tag.post_count < 1_000 %>
|
||||||
<% end %>
|
| <%= link_to "fix", new_tag_correction_path(:tag_id => tag.id) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user