From 012e752c0eae9450ff4ddf6083ad729779fd6eab Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 2 Mar 2024 12:09:57 +0300 Subject: [PATCH] Check for show redactions ability instead of moderator role when browsing elements --- app/abilities/ability.rb | 2 +- app/views/browse/_version_actions.erb | 2 +- app/views/browse/feature.html.erb | 2 +- app/views/browse/history.html.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index 960a8ea82a..637f8f1aa8 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -54,7 +54,7 @@ def initialize(user) can [:index, :create, :destroy], UserMute if user.moderator? - can :show_redactions, [OldNode, OldWay, OldRelation] + can :show_redactions, [Node, Way, Relation, OldNode, OldWay, OldRelation] can [:hide, :unhide], [DiaryEntry, DiaryComment] can [:index, :show, :resolve, :ignore, :reopen], Issue can :create, IssueComment diff --git a/app/views/browse/_version_actions.erb b/app/views/browse/_version_actions.erb index 94e18e4577..4f88b0de2b 100644 --- a/app/views/browse/_version_actions.erb +++ b/app/views/browse/_version_actions.erb @@ -3,7 +3,7 @@ <% if !@feature.redacted? %> · <%= link_to t("browse.download_xml"), :controller => "api/old_#{@type.pluralize}", :action => :show %> - <% elsif current_user&.moderator? %> + <% elsif can? :show_redactions, @feature %> · <% if !params[:show_redactions] %> <%= link_to t("browse.view_redacted_data"), :params => { :show_redactions => true } %> diff --git a/app/views/browse/feature.html.erb b/app/views/browse/feature.html.erb index 29f911f799..6962fd0d86 100644 --- a/app/views/browse/feature.html.erb +++ b/app/views/browse/feature.html.erb @@ -18,7 +18,7 @@ · <% end %> <%= link_to t("browse.view_history"), :controller => "old_#{@type.pluralize}" %> - <% if current_user&.moderator? %> + <% if can? :show_redactions, @feature %> · <%= link_to(t("browse.view_unredacted_history"), :controller => "old_#{@type.pluralize}", :params => { :show_redactions => true }) %> <% end %> diff --git a/app/views/browse/history.html.erb b/app/views/browse/history.html.erb index 1595df0216..65448f2a91 100644 --- a/app/views/browse/history.html.erb +++ b/app/views/browse/history.html.erb @@ -11,7 +11,7 @@ <% if params[:show_redactions] %> · <%= link_to t("browse.view_history") %> - <% elsif current_user&.moderator? %> + <% elsif can? :show_redactions, @feature %> · <%= link_to t("browse.view_unredacted_history"), :params => { :show_redactions => true } %> <% end %>