diff options
author | Nick Thomas <nick@gitlab.com> | 2016-10-07 00:17:11 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-10-07 04:54:25 +0300 |
commit | e94cd6fdfe43d9128d37a539cf84f4388c5cf970 (patch) | |
tree | 333c35b6a4483ee0e6b2668486a8f8c81091aa90 /app/models/abuse_report.rb | |
parent | 4a90e25f0308515bc4f240e82854a364aea47046 (diff) |
Add markdown cache columns to the database, but don't use them yet
This commit adds a number of _html columns and, with the exception of Note,
starts updating them whenever the content of their partner fields changes.
Note has a collision with the note_html attr_accessor; that will be fixed later
A background worker for clearing these cache columns is also introduced - use
`rake cache:clear` to set it off. You can clear the database or Redis caches
separately by running `rake cache:clear:db` or `rake cache:clear:redis`,
respectively.
Diffstat (limited to 'app/models/abuse_report.rb')
-rw-r--r-- | app/models/abuse_report.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index b01a244032d..2340453831e 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -1,4 +1,8 @@ class AbuseReport < ActiveRecord::Base + include CacheMarkdownField + + cache_markdown_field :message, pipeline: :single_line + belongs_to :reporter, class_name: 'User' belongs_to :user @@ -7,6 +11,9 @@ class AbuseReport < ActiveRecord::Base validates :message, presence: true validates :user_id, uniqueness: { message: 'has already been reported' } + # For CacheMarkdownField + alias_method :author, :reporter + def remove_user(deleted_by:) user.block DeleteUserWorker.perform_async(deleted_by.id, user.id, delete_solo_owned_groups: true) |