Keep track of who deletes forum post/topic/comment

Previously it would look like the creator of it was the one who
deleted/undeleted it, even if it was someone else.
This commit is contained in:
Toks
2015-07-11 13:20:47 -04:00
parent 87d3058258
commit fe7f3d8204
4 changed files with 13 additions and 5 deletions

View File

@@ -173,7 +173,7 @@ class Comment < ActiveRecord::Base
end
def delete!
update_attribute(:is_deleted, true)
update_attributes(:is_deleted => true)
end
end

View File

@@ -128,12 +128,12 @@ class ForumPost < ActiveRecord::Base
end
def delete!
update_attribute(:is_deleted, true)
update_attributes(:is_deleted => true)
update_topic_updated_at_on_delete
end
def undelete!
update_attribute(:is_deleted, false)
update_attributes(:is_deleted => false)
update_topic_updated_at_on_undelete
end

View File

@@ -151,4 +151,12 @@ class ForumTopic < ActiveRecord::Base
topic.update_attribute(:response_count, topic.response_count + self.posts.length)
self.update_columns(:response_count => 0, :is_deleted => true)
end
def delete!
update_attributes(:is_deleted => true)
end
def undelete!
update_attributes(:is_deleted => false)
end
end