Fixes #2694: hide "revert all" when user has over 1000 post changes

This commit is contained in:
Type-kun
2017-01-16 18:43:36 +05:00
parent 5ce26c2e52
commit 15b711e423
2 changed files with 5 additions and 1 deletions

View File

@@ -25,4 +25,8 @@ class UserRevert
x.undo! x.undo!
end end
end end
def self.can_revert?(user)
user.post_update_count <= THRESHOLD
end
end end

View File

@@ -58,7 +58,7 @@
<th>Post Changes</th> <th>Post Changes</th>
<td> <td>
<%= presenter.post_version_count(self) %> <%= presenter.post_version_count(self) %>
<% if CurrentUser.is_janitor? %> <% if CurrentUser.is_moderator? && UserRevert.can_revert?(user)%>
[<%= link_to "revert all", new_user_revert_path(user_id: user.id) %>] [<%= link_to "revert all", new_user_revert_path(user_id: user.id) %>]
<% end %> <% end %>
</td> </td>