Add deleted_by to Trashable tables

This commit is contained in:
Robin Ward
2013-07-09 15:20:18 -04:00
parent 4c0fe3bc12
commit b7327942af
18 changed files with 62 additions and 38 deletions

View File

@@ -37,12 +37,14 @@ class PostDestroyer
# Feature users in the topic
Jobs.enqueue(:feature_topic_users, topic_id: @post.topic_id, except_post_id: @post.id)
@post.post_actions.map(&:trash!)
@post.post_actions.each do |pa|
pa.trash!(@user)
end
f = PostActionType.types.map{|k,v| ["#{k}_count", 0]}
Post.with_deleted.where(id: @post.id).update_all(Hash[*f.flatten])
@post.trash!
@post.trash!(@user)
Topic.reset_highest(@post.topic_id)
@@ -59,7 +61,7 @@ class PostDestroyer
# Remove any notifications that point to this deleted post
Notification.delete_all topic_id: @post.topic_id, post_number: @post.post_number
@post.topic.trash! if @post.post_number == 1
@post.topic.trash!(@user) if @post.post_number == 1
end
end