Permalink
Browse files

allow comment spam flagging

  • Loading branch information...
1 parent c630914 commit 0b1311f8b3ac7de4fa52f98bea43fb81872c00ac @bborn committed May 30, 2011
@@ -125,6 +125,9 @@ def create
def destroy
@comment = Comment.find(params[:id])
if @comment.can_be_deleted_by(current_user) && @comment.destroy
+ if params[:spam] && AppConfig.akismet_key
+ @comment.spam!
+ end
flash.now[:notice] = :the_comment_was_deleted.l
else
flash.now[:error] = :comment_could_not_be_deleted.l
@@ -143,6 +146,7 @@ def delete_selected
if params[:delete]
params[:delete].each { |id|
comment = Comment.find(id)
+ comment.spam! if params[:spam] && AppConfig.akismet_key
comment.destroy if comment.can_be_deleted_by(current_user)
}
end
@@ -10,12 +10,19 @@
=f.label :commentable_id.l
=f.text_field :commentable_id
+ =f.label :name.l
+ =f.text_field :author_name_or_user_login_like
+
=f.label :email.l
- =f.text_field :author_email_or_user_email_like
+ =f.text_field :author_email_like
+
+ =f.label :comment_web_site_label.l
+ =f.text_field :author_url_like
+ =f.label :body_text.l
+ =f.text_field :comment_like
%p= f.submit :search.l
-
- form_tag delete_selected_comments_path, :id => 'comments' do
@@ -31,15 +38,19 @@
%table{"cellspacing"=>"0", "border"=>"0", "cellpadding"=>"0", "width"=>"100%", :style => "table-layout:fixed;"}
%thead
%tr
- %th{:width => '30px', :colspan => '2'}
+ %th{:width => '60px', :colspan => '3'}
%th=:author.l
%th{:width => "250px"}=:body_text.l
%th=:on_commentable.l
%tbody
- @comments.each do |comment|
%tr{:id => "comment_#{comment.id}"}
- %td=link_to_remote(image_tag('icons/delete.png', :plugin => 'community_engine'), {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => "Are you sure you want to permanently delete this comment"} )
+ %td
+ =link_to_remote(image_tag('icons/delete.png', :plugin => 'community_engine'), {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => "Are you sure you want to permanently delete this comment"} )
+ %td
+ =link_to_remote(image_tag('icons/bad-flag.png', :plugin => 'community_engine'), {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => "Are you sure you want to permanently delete this comment and mark it as spam!?"} )
+
%td= check_box_tag "delete[]", comment.id
%td
.left
@@ -63,6 +74,7 @@
-if @comments.any?
%a{:href=>"#", :onclick=>"checkboxes.each(function(e){ e.checked = (e.checked == 0 ? 1 : 0) }); return false;"} Toggle all
%p= submit_tag :delete_selected.l
+ %p= submit_tag :delete_selected_mark_as_spam.l
-if @comments.page_count > 1
View
@@ -355,6 +355,8 @@ en:
delete: Delete
#en: delete_selected: Delete selected
delete_selected: Delete selected
+ #en: delete_selected_mark_as_spam: Delete selected and mark spam
+ delete_selected_mark_as_spam: Delete selected and mark spam
#en: delete_this_event: Delete this event
delete_this_event: Delete this event
#en: delete_this_forum: Delete this forum
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0b1311f

Please sign in to comment.