From 8900b1ffcee4562dd37d8e245a1384aa1dabafd6 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 11 Jun 2018 18:36:52 +0200 Subject: [PATCH] Shows flag actions div only if user can hide --- .../proposal_notifications/_actions.html.erb | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/views/proposal_notifications/_actions.html.erb b/app/views/proposal_notifications/_actions.html.erb index bcac9cb4f..37f6bdac3 100644 --- a/app/views/proposal_notifications/_actions.html.erb +++ b/app/views/proposal_notifications/_actions.html.erb @@ -1,14 +1,16 @@ -
- - <% if can? :hide, notification %> - <%= link_to t("admin.actions.hide").capitalize, hide_moderation_proposal_notification_path(notification), - method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %> - <% end %> +<% if can? :hide, (notification || notification.author) %> +
+ + <% if can? :hide, notification %> + <%= link_to t("admin.actions.hide").capitalize, hide_moderation_proposal_notification_path(notification), + method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %> + <% end %> - <% if can? :hide, notification.author %> -  •  - <%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(notification.author_id), - method: :put, data: { confirm: t('admin.actions.confirm') } %> - <% end %> - -
+ <% if can? :hide, notification.author %> +  •  + <%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(notification.author_id), + method: :put, data: { confirm: t('admin.actions.confirm') } %> + <% end %> +
+
+<% end %>