Merge branch 'kb_development' into kb_migration

This commit is contained in:
KMY 2023-08-09 08:53:06 +09:00
commit 6cfe78d51c
22 changed files with 541 additions and 32 deletions

View file

@ -514,7 +514,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
note = @account&.note
return nil if note.blank?
searchability_bio = note.scan(SCAN_SEARCHABILITY_RE).first || note.scan(SCAN_SEARCHABILITY_FEDIBIRD_RE).first
searchability_bio = note.scan(SCAN_SEARCHABILITY_FEDIBIRD_RE).first || note.scan(SCAN_SEARCHABILITY_RE).first
return nil unless searchability_bio
searchability = searchability_bio[0]

View file

@ -40,7 +40,7 @@ class CustomEmoji < ApplicationRecord
belongs_to :category, class_name: 'CustomEmojiCategory', optional: true
has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode, inverse_of: false
has_many :emoji_reactions, inverse_of: :custom_emoji
has_many :emoji_reactions, inverse_of: :custom_emoji, dependent: :destroy
has_attached_file :image, styles: { static: { format: 'png', convert_options: '-coalesce +profile "!icc,*" +set modify-date +set create-date' } }, validate_media_type: false

View file

@ -19,13 +19,12 @@ class PublicFeed
# @param [Integer] min_id
# @return [Array<Status>]
def get(limit, max_id = nil, since_id = nil, min_id = nil)
scope = public_scope
scope = local_only? ? public_scope : global_timeline_only_scope
scope.merge!(without_replies_scope) unless with_replies?
scope.merge!(without_reblogs_scope) unless with_reblogs?
scope.merge!(local_only_scope) if local_only?
scope.merge!(remote_only_scope) if remote_only? || hide_local_users?
scope.merge!(global_timeline_only_scope) if global_timeline?
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
scope.merge!(language_scope) if account&.chosen_languages.present?
@ -58,10 +57,6 @@ class PublicFeed
@account.nil? && Setting.hide_local_users_for_anonymous
end
def global_timeline?
!options[:remote] && !options[:local]
end
def account?
account.present?
end
@ -74,6 +69,10 @@ class PublicFeed
Status.with_public_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
end
def global_timeline_only_scope
Status.with_global_timeline_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
end
def public_search_scope
Status.with_public_search_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
end
@ -86,10 +85,6 @@ class PublicFeed
Status.remote
end
def global_timeline_only_scope
Status.with_global_timeline_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
end
def without_replies_scope
Status.without_replies
end
@ -107,7 +102,7 @@ class PublicFeed
end
def anonymous_scope
Status.where(visibility: [:public, :public_unlisted])
local_only? ? Status.where(visibility: [:public, :public_unlisted]) : Status.where(visibility: :public)
end
def account_filters_scope

View file

@ -106,7 +106,9 @@ class Trends::Statuses < Trends::Base
private
def eligible?(status)
(status.searchability.nil? || status.public_searchability?) && (status.public_visibility? || status.public_unlisted_visibility?) && status.account.discoverable? && !status.account.silenced? && status.spoiler_text.blank? && (!status.sensitive? || status.media_attachments.none?) && !status.reply? && valid_locale?(status.language)
(status.searchability.nil? || status.public_searchability?) && (status.public_visibility? || status.public_unlisted_visibility?) &&
status.account.discoverable? && !status.account.silenced? && status.spoiler_text.blank? && (!status.sensitive? || status.media_attachments.none?) &&
!status.reply? && valid_locale?(status.language)
end
def calculate_scores(statuses, at_time)

View file

@ -269,9 +269,11 @@ class ActivityPub::ProcessAccountService < BaseService
if audience_searchable_by.any? { |uri| ActivityPub::TagManager.instance.public_collection?(uri) }
:public
elsif audience_searchable_by.include?(@account.followers_url)
:private # Followers only in kmyblue (generics: private)
:private
elsif audience_searchable_by.include?('as:Limited')
:limited
else
:direct # Reaction only in kmyblue (generics: direct)
:direct
end
end
@ -279,7 +281,7 @@ class ActivityPub::ProcessAccountService < BaseService
note = @json['summary'] || ''
return nil if note.blank?
searchability_bio = note.scan(SCAN_SEARCHABILITY_RE).first || note.scan(SCAN_SEARCHABILITY_FEDIBIRD_RE).first
searchability_bio = note.scan(SCAN_SEARCHABILITY_FEDIBIRD_RE).first || note.scan(SCAN_SEARCHABILITY_RE).first
return nil unless searchability_bio
searchability = searchability_bio[0]

View file

@ -39,11 +39,13 @@ class UpdateStatusService < BaseService
queue_poll_notifications!
reset_preview_card!
update_references!
update_metadata!
update_references!
broadcast_updates!
# Mentions are not updated (Cause unknown)
@status.reload
@status
rescue NoChangesSubmittedError
# For calls that result in no changes, swallow the error
@ -165,7 +167,6 @@ class UpdateStatusService < BaseService
def update_metadata!
ProcessHashtagsService.new.call(@status)
ProcessMentionsService.new.call(@status)
ProcessReferencesWorker.perform_async(@status.id, (@options[:status_reference_ids] || []).map(&:to_i).filter(&:positive?), [])
end
def broadcast_updates!

View file

@ -38,7 +38,7 @@
= yield :header_tags
%script{ src="https://www.googletagmanager.com/gtag/js?id=AW-11130587137" async }
%script{ 'src' => "https://www.googletagmanager.com/gtag/js?id=AW-11130587137", 'async' => true }
:javascript
window.dataLayer = window.dataLayer || [];