mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: log topic/post deletions from staff members
This commit is contained in:
parent
be93f224a6
commit
98b6b9821a
14 changed files with 155 additions and 33 deletions
|
@ -33,10 +33,11 @@ class PostDestroyer
|
|||
end
|
||||
end
|
||||
|
||||
def initialize(user, post)
|
||||
def initialize(user, post, opts={})
|
||||
@user = user
|
||||
@post = post
|
||||
@topic = post.topic if post
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
@ -79,7 +80,12 @@ class PostDestroyer
|
|||
@post.update_flagged_posts_count
|
||||
remove_associated_replies
|
||||
remove_associated_notifications
|
||||
@post.topic.trash!(@user) if @post.topic && @post.post_number == 1
|
||||
if @post.topic && @post.post_number == 1
|
||||
StaffActionLogger.new(@user).log_topic_deletion(@post.topic, @opts.slice(:context))
|
||||
@post.topic.trash!(@user)
|
||||
else
|
||||
StaffActionLogger.new(@user).log_post_deletion(@post, @opts.slice(:context))
|
||||
end
|
||||
update_associated_category_latest_topic
|
||||
update_user_counts
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue