From 5d2d883dd385e5cfd9018c98c1381a7b8fe4d10f Mon Sep 17 00:00:00 2001 From: Andrej Kacian <andrej@kacian.sk> Date: Fri, 26 Aug 2011 20:24:04 +0200 Subject: [PATCH] Require confirmation when deleting a comment --- app/views/comments/_comment.html.haml | 2 +- features/comments.feature | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index b92be23660..f1a11bf7d3 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -5,7 +5,7 @@ %li.comment.posted{:id => comment.guid, :class => ("hidden" if(defined? hidden))} - if current_user && (current_user.owns?(comment) || current_user.owns?(post)) .right.controls - = link_to image_tag('deletelabel.png'), post_comment_path(comment.post_id, comment), :class => "delete comment_delete", :title => t('delete') + = link_to image_tag('deletelabel.png'), post_comment_path(comment.post_id, comment), :class => "delete comment_delete", :title => t('delete'), :confirm => t('are_you_sure') = person_image_link(comment.author, :size => :thumb_small) .content %span.from diff --git a/features/comments.feature b/features/comments.feature index cdd14668a6..5d542124bc 100644 --- a/features/comments.feature +++ b/features/comments.feature @@ -47,6 +47,7 @@ Feature: commenting And I press "Comment" And I wait for the ajax to finish When I hover over the ".comment.posted" + And I preemptively confirm the alert And I click to delete the first comment And I wait for the ajax to finish And I wait for 2 seconds -- GitLab