Merge branch 'kb_development' into kb_migration
This commit is contained in:
commit
751b603e12
17 changed files with 341 additions and 44 deletions
|
@ -48,8 +48,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
|
||||
def create_status
|
||||
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity?
|
||||
return reject_payload! if (reply_to_local? || reply_to_local_account?) && reject_reply_to_local?
|
||||
return reject_payload! if (!reply_to_local_account_following? || !reply_to_local_status_following?) && reject_reply_exclude_followers?
|
||||
|
||||
with_redis_lock("create:#{object_uri}") do
|
||||
return if delete_arrived_first?(object_uri) || poll_vote?
|
||||
|
@ -63,7 +61,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
end
|
||||
|
||||
@status
|
||||
@status || reject_payload!
|
||||
end
|
||||
|
||||
def audience_to
|
||||
|
@ -90,7 +88,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
process_tags
|
||||
process_audience
|
||||
|
||||
return unless valid_status?
|
||||
return nil unless valid_status?
|
||||
return nil if (reply_to_local? || reply_to_local_account? || reply_to_local_from_tags?) && reject_reply_to_local?
|
||||
return nil if (!reply_to_local_account_following? || !reply_to_local_status_following? || !reply_to_local_from_tags_following?) && reject_reply_exclude_followers?
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
@status = Status.create!(@params)
|
||||
|
@ -148,14 +148,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
!Admin::NgWord.reject?("#{@params[:spoiler_text]}\n#{@params[:text]}") && !Admin::NgWord.hashtag_reject?(@tags.size)
|
||||
end
|
||||
|
||||
def reply_to_local_account?
|
||||
accounts_in_audience.any?(&:local?)
|
||||
end
|
||||
|
||||
def reply_to_local_account_following?
|
||||
!reply_to_local_account? || accounts_in_audience.none? { |account| account.local? && !account.following?(@account) }
|
||||
end
|
||||
|
||||
def accounts_in_audience
|
||||
return @accounts_in_audience if @accounts_in_audience
|
||||
|
||||
|
@ -420,6 +412,22 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
@skip_download ||= DomainBlock.reject_media?(@account.domain)
|
||||
end
|
||||
|
||||
def reply_to_local_account?
|
||||
accounts_in_audience.any?(&:local?)
|
||||
end
|
||||
|
||||
def reply_to_local_account_following?
|
||||
!reply_to_local_account? || accounts_in_audience.none? { |account| account.local? && !account.following?(@account) }
|
||||
end
|
||||
|
||||
def reply_to_local_from_tags?
|
||||
(@mentions.present? && @mentions.any? { |m| m.account.local? })
|
||||
end
|
||||
|
||||
def reply_to_local_from_tags_following?
|
||||
(@mentions.present? && @mentions.none? { |m| m.account.local? && !m.account.following?(@account) })
|
||||
end
|
||||
|
||||
def reply_to_local?
|
||||
!replied_to_status.nil? && replied_to_status.account.local?
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ class SearchQueryTransformer < Parslet::Transform
|
|||
|
||||
def to_query
|
||||
# { multi_match: { type: 'most_fields', query: @term, fields: ['text', 'text.stemmed'], operator: 'and' } }
|
||||
{ match_phrase: { text: { query: @phrase } } }
|
||||
{ match_phrase: { text: { query: @term } } }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue