From 330a412714e7f8a289532809828cf02eb66b1846 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 19 Nov 2021 17:37:55 -0600 Subject: [PATCH] Fix #4924: Moderator dashboard shouldn't show a "Promote" link that's unusable by non-moderators Remove these links entirely. --- app/helpers/application_helper.rb | 19 ------------------- .../dashboards/_activity_artist.html.erb | 2 +- .../dashboards/_activity_comment.html.erb | 2 +- .../dashboards/_activity_note.html.erb | 2 +- .../dashboards/_activity_tag.html.erb | 2 +- .../dashboards/_activity_upload.html.erb | 2 +- .../dashboards/_activity_wiki_page.html.erb | 2 +- 7 files changed, 6 insertions(+), 25 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f9abfbbf4..d8a27e2d0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -206,25 +206,6 @@ module ApplicationHelper link_to(text, user, class: user_class, data: data) end - def mod_link_to_user(user, positive_or_negative) - html = "" - html << link_to_user(user) - - if CurrentUser.is_gold? && user != CurrentUser.user - if positive_or_negative == :positive - html << " [" + link_to("+", new_user_feedback_path(:user_feedback => {:category => "positive", :user_id => user.id})) + "]" - - if CurrentUser.is_moderator? && !user.is_builder? - html << " [" + link_to("promote", edit_admin_user_path(user)) + "]" - end - else - html << " [" + link_to("–".html_safe, new_user_feedback_path(:user_feedback => {:category => "negative", :user_id => user.id})) + "]" - end - end - - html.html_safe - end - def embed_wiki(title, **options) wiki = WikiPage.find_by(title: title) text = format_text(wiki&.body) diff --git a/app/views/moderator/dashboards/_activity_artist.html.erb b/app/views/moderator/dashboards/_activity_artist.html.erb index 8317ad790..cbfd3e996 100644 --- a/app/views/moderator/dashboards/_activity_artist.html.erb +++ b/app/views/moderator/dashboards/_activity_artist.html.erb @@ -9,7 +9,7 @@ <% @dashboard.artists.each do |activity| %> - <%= mod_link_to_user(activity.user, :positive) %> + <%= link_to_user(activity.user) %> <%= link_to activity.count, artist_versions_path(:search => {:updater_id => activity.user.id}) %> <% end %> diff --git a/app/views/moderator/dashboards/_activity_comment.html.erb b/app/views/moderator/dashboards/_activity_comment.html.erb index 55e03031d..f14731771 100644 --- a/app/views/moderator/dashboards/_activity_comment.html.erb +++ b/app/views/moderator/dashboards/_activity_comment.html.erb @@ -21,7 +21,7 @@ <% end %> - <%= mod_link_to_user(activity.comment.creator, :negative) %> + <%= link_to_user(activity.comment.creator) %> <%= activity.count %> <%= activity.comment.score %> diff --git a/app/views/moderator/dashboards/_activity_note.html.erb b/app/views/moderator/dashboards/_activity_note.html.erb index 2da47f35c..87143821e 100644 --- a/app/views/moderator/dashboards/_activity_note.html.erb +++ b/app/views/moderator/dashboards/_activity_note.html.erb @@ -9,7 +9,7 @@ <% @dashboard.notes.each do |activity| %> - <%= mod_link_to_user(activity.user, :positive) %> + <%= link_to_user(activity.user) %> <%= link_to activity.count, note_versions_path(:search => {:updater_id => activity.user.id}) %> <% end %> diff --git a/app/views/moderator/dashboards/_activity_tag.html.erb b/app/views/moderator/dashboards/_activity_tag.html.erb index f08670016..847f5a314 100644 --- a/app/views/moderator/dashboards/_activity_tag.html.erb +++ b/app/views/moderator/dashboards/_activity_tag.html.erb @@ -9,7 +9,7 @@ <% @dashboard.tags.each do |activity| %> - <%= mod_link_to_user(activity.user, :positive) %> + <%= link_to_user(activity.user) %> <%= link_to activity.count, post_versions_path(:search => {:updater_id => activity.user.id}) %> <% end %> diff --git a/app/views/moderator/dashboards/_activity_upload.html.erb b/app/views/moderator/dashboards/_activity_upload.html.erb index 8d2bae2ee..7613b1d6f 100644 --- a/app/views/moderator/dashboards/_activity_upload.html.erb +++ b/app/views/moderator/dashboards/_activity_upload.html.erb @@ -9,7 +9,7 @@ <% @dashboard.posts.each do |activity| %> - <%= mod_link_to_user(activity.user, :positive) %> + <%= link_to_user(activity.user) %> <%= link_to activity.count, posts_path(:tags => "user:#{activity.user.name}") %> <% end %> diff --git a/app/views/moderator/dashboards/_activity_wiki_page.html.erb b/app/views/moderator/dashboards/_activity_wiki_page.html.erb index 6d2cc4c58..6cb6360b6 100644 --- a/app/views/moderator/dashboards/_activity_wiki_page.html.erb +++ b/app/views/moderator/dashboards/_activity_wiki_page.html.erb @@ -9,7 +9,7 @@ <% @dashboard.wiki_pages.each do |activity| %> - <%= mod_link_to_user(activity.user, :positive) %> + <%= link_to_user(activity.user) %> <%= link_to activity.count, wiki_page_versions_path(:search => {:updater_id => activity.user.id}) %> <% end %>