models: add deletable concern.

This commit is contained in:
evazion
2020-03-06 17:06:29 -06:00
parent 32bad825e1
commit 5bc0ab446b
13 changed files with 30 additions and 37 deletions

View File

@@ -30,7 +30,7 @@ class ForumTopic < ApplicationRecord
ModAction.log("locked forum topic ##{id} (title: #{title})", :forum_topic_lock)
end
scope :active, -> { where(is_deleted: false) }
deletable
module CategoryMethods
extend ActiveSupport::Concern
@@ -158,14 +158,6 @@ class ForumTopic < ApplicationRecord
(response_count / Danbooru.config.posts_per_page.to_f).ceil
end
def delete!
update(is_deleted: true)
end
def undelete!
update(is_deleted: false)
end
def update_orignal_post
original_post&.update_columns(:updater_id => updater.id, :updated_at => Time.now)
end