|
|
@ -111,6 +111,9 @@ class Status < ApplicationRecord
|
|
|
|
where('NOT EXISTS (SELECT * FROM statuses_tags forbidden WHERE forbidden.status_id = statuses.id AND forbidden.tag_id IN (?))', tag_ids)
|
|
|
|
where('NOT EXISTS (SELECT * FROM statuses_tags forbidden WHERE forbidden.status_id = statuses.id AND forbidden.tag_id IN (?))', tag_ids)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
after_create_commit :trigger_create_webhooks
|
|
|
|
|
|
|
|
after_update_commit :trigger_update_webhooks
|
|
|
|
|
|
|
|
|
|
|
|
cache_associated :application,
|
|
|
|
cache_associated :application,
|
|
|
|
:media_attachments,
|
|
|
|
:media_attachments,
|
|
|
|
:conversation,
|
|
|
|
:conversation,
|
|
|
@ -535,4 +538,12 @@ class Status < ApplicationRecord
|
|
|
|
reblog&.decrement_count!(:reblogs_count) if reblog?
|
|
|
|
reblog&.decrement_count!(:reblogs_count) if reblog?
|
|
|
|
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && distributable?
|
|
|
|
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && distributable?
|
|
|
|
end
|
|
|
|
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
|
|
|
|
end
|
|
|
|