set local_only in a before_create callback instead of status service

main
Erin 2017-12-10 21:39:27 -06:00
parent 0c46058a43
commit 288f1293ef
2 changed files with 8 additions and 3 deletions

View File

@ -141,6 +141,8 @@ class Status < ApplicationRecord
around_create Mastodon::Snowflake::Callbacks
before_create :set_locality
before_validation :prepare_contents, if: :local?
before_validation :set_reblog
before_validation :set_visibility
@ -302,6 +304,12 @@ class Status < ApplicationRecord
self.sensitive = sensitive || spoiler_text.present?
end
def set_locality
if account.domain.nil?
self.local_only = marked_local_only?
end
end
def set_conversation
self.reply = !(in_reply_to_id.nil? && thread.nil?) unless reply

View File

@ -40,9 +40,6 @@ class PostStatusService < BaseService
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text?
DistributionWorker.perform_async(status.id)
status.local_only = status.marked_local_only?
status.save!
unless status.local_only
Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id)
ActivityPub::DistributionWorker.perform_async(status.id)