diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-16 23:18:38 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:18 -0500 |
commit | b1e6e6957e62f3da3857f42ec6c343cb9660434d (patch) | |
tree | e1305ef8cf98aabe10fa58c8bc27d0408c681066 /app/models/status.rb | |
parent | af0b6f445c597b41e861da9e77f39b4caed3e753 (diff) |
[Federation] Include and dereference URI to the root post of threads; dynamically update thread permissions
Diffstat (limited to 'app/models/status.rb')
-rw-r--r-- | app/models/status.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 9067f44df..9c061bf85 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -376,6 +376,7 @@ class Status < ApplicationRecord after_destroy_commit :decrement_counter_caches after_create_commit :store_uri, if: :local? + after_create_commit :store_url, if: :local? after_create_commit :update_statistics, if: :local? around_create Mastodon::Snowflake::Callbacks @@ -392,6 +393,7 @@ class Status < ApplicationRecord after_save :set_domain_permissions, if: :local? after_save :set_semiprivate, if: :local? + after_save :set_conversation_root class << self def selectable_visibilities @@ -676,6 +678,10 @@ class Status < ApplicationRecord update_column(:uri, ActivityPub::TagManager.instance.uri_for(self)) if uri.nil? end + def store_url + update_column(:url, ActivityPub::TagManager.instance.url_for(self)) if url.nil? + end + def prepare_contents text&.strip! spoiler_text&.strip! @@ -717,6 +723,10 @@ class Status < ApplicationRecord end end + def set_conversation_root + conversation.update!(root: uri, account_id: account_id, public: distributable?) if !reply && conversation.root.blank? + end + def carried_over_reply_to_account_id if thread.account_id == account_id && thread.reply? thread.in_reply_to_account_id |