mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
@@ -56,11 +56,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
process_audience
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
@status = Status.create!(@params)
|
||||
@status = Status.create!(@params.merge(quote: @quote))
|
||||
attach_tags(@status)
|
||||
attach_mentions(@status)
|
||||
attach_counts(@status)
|
||||
attach_quote(@status)
|
||||
end
|
||||
|
||||
resolve_thread(@status)
|
||||
@@ -202,13 +201,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
end
|
||||
end
|
||||
|
||||
def attach_quote(status)
|
||||
return if @quote.nil?
|
||||
|
||||
@quote.status = status
|
||||
@quote.save
|
||||
end
|
||||
|
||||
def process_tags
|
||||
return if @object['tag'].nil?
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ class Status < ApplicationRecord
|
||||
has_one :quote, inverse_of: :status, dependent: :destroy
|
||||
|
||||
validates :uri, uniqueness: true, presence: true, unless: :local?
|
||||
validates :text, presence: true, unless: -> { with_media? || reblog? }
|
||||
validates :text, presence: true, unless: -> { with_media? || reblog? || with_quote? }
|
||||
validates_with StatusLengthValidator
|
||||
validates_with DisallowedHashtagsValidator
|
||||
validates :reblog, uniqueness: { scope: :account }, if: :reblog?
|
||||
@@ -256,6 +256,10 @@ class Status < ApplicationRecord
|
||||
ordered_media_attachments.any?
|
||||
end
|
||||
|
||||
def with_quote?
|
||||
quote.present?
|
||||
end
|
||||
|
||||
def with_preview_card?
|
||||
preview_cards_status.present?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user