Implement FEP 7888: Part 1 - publish conversation context (#35959)

This commit is contained in:
Jesse Karmani 2025-09-05 12:28:29 -07:00 committed by GitHub
parent 9463a31107
commit 65b4a0a6f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 309 additions and 12 deletions

View file

@ -70,6 +70,8 @@ class Status < ApplicationRecord
belongs_to :reblog, foreign_key: 'reblog_of_id', inverse_of: :reblogs
end
has_one :owned_conversation, class_name: 'Conversation', foreign_key: 'parent_status_id', inverse_of: :parent_status, dependent: nil
has_many :favourites, inverse_of: :status, dependent: :destroy
has_many :bookmarks, inverse_of: :status, dependent: :destroy
has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblog, dependent: :destroy
@ -442,7 +444,8 @@ class Status < ApplicationRecord
self.in_reply_to_account_id = carried_over_reply_to_account_id
self.conversation_id = thread.conversation_id if conversation_id.nil?
elsif conversation_id.nil?
self.conversation = Conversation.new
conversation = build_owned_conversation
self.conversation = conversation
end
end