about summary refs log tree commit diff stats
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-17 11:43:07 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-17 11:43:07 -0400
commit8d039903f630db0b89f2df44a94f4e5c938bd7bf (patch)
tree80d33266fff46582bc4ea7d1fc31f7b73efca965 /app/controllers/admin
parent4369be26b98e874ec560f92b6fd204deca8bd609 (diff)
downloadthoughts-8d039903f630db0b89f2df44a94f4e5c938bd7bf.tar.gz
thoughts-8d039903f630db0b89f2df44a94f4e5c938bd7bf.tar.bz2
thoughts-8d039903f630db0b89f2df44a94f4e5c938bd7bf.zip
Added marking comments as spam
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/comments_controller.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index 9958232..d3d948c 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb
@@ -31,6 +31,29 @@ class Admin::CommentsController < Admin::AdminController
31 redirect_to pending_admin_comments_url 31 redirect_to pending_admin_comments_url
32 end 32 end
33 33
34 def mark_spam
35 @comment = Comment.find(params[:id])
36
37 akismet_params = {
38 type: "comment",
39 text: @comment.body,
40 created_at: @comment.created_at,
41 author: @comment.username,
42 author_email: @comment.email,
43 author_url: @comment.website,
44 post_url: url_for(@comment.blog),
45 post_modified_at: @comment.blog.updated_at,
46 referrer: @comment.referrer
47 }
48
49 Akismet.spam @comment.request_ip, @comment.user_agent, akismet_params
50
51 @comment.destroy!
52
53 flash.notice = "Comment successfully marked as spam."
54 redirect_back pending_admin_comments_url
55 end
56
34 def destroy 57 def destroy
35 if Comment.destroy(params[:id]) 58 if Comment.destroy(params[:id])
36 flash.notice = "Comment successfully deleted." 59 flash.notice = "Comment successfully deleted."