From 0321b979d08043f0cde80ea1bbf0afdf6c048d7e Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 3 Feb 2020 21:55:14 -0600 Subject: [PATCH] dmails: fix respond links being shown to non-owner on show page. --- app/views/dmails/show.html.erb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/dmails/show.html.erb b/app/views/dmails/show.html.erb index 90562b32a..065b6f2ac 100644 --- a/app/views/dmails/show.html.erb +++ b/app/views/dmails/show.html.erb @@ -24,14 +24,16 @@ <% end %> -

- <%= link_to "Respond", new_dmail_path(:respond_to_id => @dmail) %> - | <%= link_to "Forward", new_dmail_path(:respond_to_id => @dmail, :forward => true) %> - | <%= link_to "Share", dmail_path(@dmail, key: @dmail.key), title: "Anyone with this link will be able to view this dmail." %> - <% if @dmail.reportable_by?(CurrentUser.user) %> - | <%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Dmail", model_id: @dmail.id }), remote: true, title: "Report this dmail to the moderators" %> - <% end %> -

+ <% if CurrentUser.user == @dmail.owner %> +

+ <%= link_to "Respond", new_dmail_path(:respond_to_id => @dmail) %> + | <%= link_to "Forward", new_dmail_path(:respond_to_id => @dmail, :forward => true) %> + | <%= link_to "Share", dmail_path(@dmail, key: @dmail.key), title: "Anyone with this link will be able to view this dmail." %> + <% if @dmail.reportable_by?(CurrentUser.user) %> + | <%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Dmail", model_id: @dmail.id }), remote: true, title: "Report this dmail to the moderators" %> + <% end %> +

+ <% end %>