Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/models/status.rb`: Upstream added lines close to a glitch-soc only line, not a real conflict. Applied upstream's changes (added hooks) while keeping glitch-soc's changes (`local_only` scope). - `config/environments/production.rb`: Upstream removed a header, while we have glitch-soc specific ones. Removed the header removed upstream.
This commit is contained in:
@ -116,6 +116,9 @@ class Status < ApplicationRecord
|
||||
|
||||
scope :not_local_only, -> { where(local_only: [false, nil]) }
|
||||
|
||||
after_create_commit :trigger_create_webhooks
|
||||
after_update_commit :trigger_update_webhooks
|
||||
|
||||
cache_associated :application,
|
||||
:media_attachments,
|
||||
:conversation,
|
||||
@ -142,6 +145,10 @@ class Status < ApplicationRecord
|
||||
|
||||
REAL_TIME_WINDOW = 6.hours
|
||||
|
||||
def cache_key
|
||||
"v2:#{super}"
|
||||
end
|
||||
|
||||
def searchable_by(preloaded = nil)
|
||||
ids = []
|
||||
|
||||
@ -597,4 +604,12 @@ class Status < ApplicationRecord
|
||||
reblog&.decrement_count!(:reblogs_count) if reblog?
|
||||
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && distributable?
|
||||
end
|
||||
|
||||
def trigger_create_webhooks
|
||||
TriggerWebhookWorker.perform_async('status.created', 'Status', id) if local?
|
||||
end
|
||||
|
||||
def trigger_update_webhooks
|
||||
TriggerWebhookWorker.perform_async('status.updated', 'Status', id) if local?
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user