Merge commit '9ffe6817e0' into kb_migration

This commit is contained in:
KMY 2023-05-25 09:03:06 +09:00
commit db5c358f4f
54 changed files with 155 additions and 79 deletions

View file

@ -30,6 +30,7 @@ class AccountStatusesFilter
scope.merge!(scope.where.not(visibility: :public_unlisted)) if domain_block&.reject_send_public_unlisted || (domain_block&.detect_invalid_subscription && @account.user&.setting_reject_public_unlisted_subscription)
scope.merge!(scope.where.not(visibility: :unlisted)) if domain_block&.detect_invalid_subscription && @account.user&.setting_reject_unlisted_subscription
scope.merge!(scope.where(spoiler_text: ['', nil])) if domain_block&.reject_send_sensitive
scope.merge!(scope.where.not(visibility: :login)) if current_account.nil?
scope
end
@ -51,7 +52,7 @@ class AccountStatusesFilter
def filtered_scope
scope = account.statuses.left_outer_joins(:mentions)
scope.merge!(scope.where(visibility: follower? ? %i(public unlisted public_unlisted private) : %i(public unlisted public_unlisted)).or(scope.where(mentions: { account_id: current_account.id })).group(Status.arel_table[:id]))
scope.merge!(scope.where(visibility: follower? ? %i(public unlisted public_unlisted login private) : %i(public unlisted public_unlisted login)).or(scope.where(mentions: { account_id: current_account.id })).group(Status.arel_table[:id]))
scope.merge!(filtered_reblogs_scope) if reblogs_may_occur?
scope

View file

@ -16,7 +16,7 @@ class Admin::StatusFilter
end
def results
scope = @account.statuses.where(visibility: [:public, :unlisted, :public_unlisted])
scope = @account.statuses.where(visibility: [:public, :unlisted, :public_unlisted, :login])
params.each do |key, value|
next if IGNORED_PARAMS.include?(key.to_s)

View file

@ -220,7 +220,7 @@ class Antenna < ApplicationRecord
private
def validate_limit
errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: LIMIT)) if account.antennas.count >= LIMIT
errors.add(:base, I18n.t('antennas.errors.over_limit', limit: LIMIT)) if account.antennas.count >= LIMIT
end
def validate_stl_limit
@ -228,6 +228,6 @@ class Antenna < ApplicationRecord
stls = account.antennas.where(stl: true).where.not(id: id)
errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: LIMIT)) if list_id.zero? ? stls.any? { |tl| tl.list_id.zero? } : stls.any? { |tl| tl.list_id != 0 }
errors.add(:base, I18n.t('antennas.errors.over_stl_limit', limit: 1)) if list_id.zero? ? stls.any? { |tl| tl.list_id.zero? } : stls.any? { |tl| tl.list_id != 0 }
end
end

View file

@ -23,6 +23,10 @@ module HasUserSettings
settings['web.auto_play']
end
def setting_enable_login_privacy
settings['web.enable_login_privacy']
end
def setting_default_sensitive
settings['default_sensitive']
end

View file

@ -12,7 +12,7 @@ module StatusThreadingConcern
end
def self_replies(limit)
account.statuses.where(in_reply_to_id: id, visibility: [:public, :unlisted, :public_unlisted]).reorder(id: :asc).limit(limit)
account.statuses.where(in_reply_to_id: id, visibility: [:public, :unlisted, :public_unlisted, :login]).reorder(id: :asc).limit(limit)
end
private

View file

@ -45,7 +45,7 @@ class FeaturedTag < ApplicationRecord
end
def decrement(deleted_status_id)
update(statuses_count: [0, statuses_count - 1].max, last_status_at: account.statuses.where(visibility: %i(public unlisted public_unlisted)).tagged_with(tag).where.not(id: deleted_status_id).select(:created_at).first&.created_at)
update(statuses_count: [0, statuses_count - 1].max, last_status_at: account.statuses.where(visibility: %i(public unlisted public_unlisted login)).tagged_with(tag).where.not(id: deleted_status_id).select(:created_at).first&.created_at)
end
private
@ -59,8 +59,8 @@ class FeaturedTag < ApplicationRecord
end
def reset_data
self.statuses_count = account.statuses.where(visibility: %i(public unlisted public_unlisted)).tagged_with(tag).count
self.last_status_at = account.statuses.where(visibility: %i(public unlisted public_unlisted)).tagged_with(tag).select(:created_at).first&.created_at
self.statuses_count = account.statuses.where(visibility: %i(public unlisted public_unlisted login)).tagged_with(tag).count
self.last_status_at = account.statuses.where(visibility: %i(public unlisted public_unlisted login)).tagged_with(tag).select(:created_at).first&.created_at
end
def validate_featured_tags_limit

View file

@ -29,6 +29,7 @@ class PublicFeed
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
scope.merge!(language_scope) if account&.chosen_languages.present?
scope.merge!(anonymous_scope) unless account?
scope.cache_ids.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
end
@ -97,6 +98,10 @@ class PublicFeed
Status.where(language: account.chosen_languages)
end
def anonymous_scope
Status.where.not(visibility: :login)
end
def account_filters_scope
Status.not_excluded_by_account(account).tap do |scope|
scope.merge!(Status.not_domain_blocked_by_account(account)) unless local_only?

View file

@ -52,7 +52,7 @@ class Status < ApplicationRecord
update_index('statuses', :proper)
enum visibility: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4, public_unlisted: 10 }, _suffix: :visibility
enum visibility: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4, public_unlisted: 10, login: 11 }, _suffix: :visibility
enum searchability: { public: 0, private: 1, direct: 2, limited: 3, public_unlisted: 10 }, _suffix: :searchability
belongs_to :application, class_name: 'Doorkeeper::Application', optional: true
@ -102,8 +102,8 @@ class Status < ApplicationRecord
scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') }
scope :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) }
scope :with_public_visibility, -> { where(visibility: [:public, :public_unlisted]) }
scope :with_global_timeline_visibility, -> { where(visibility: [:public]) }
scope :with_public_visibility, -> { where(visibility: [:public, :public_unlisted, :login]) }
scope :with_global_timeline_visibility, -> { where(visibility: [:public, :login]) }
scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) }
scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) }
scope :including_silenced_accounts, -> { left_outer_joins(:account).where.not(accounts: { silenced_at: nil }) }
@ -409,7 +409,7 @@ class Status < ApplicationRecord
end
def selectable_searchabilities
searchabilities.keys - %w(public_unlisted limited)
searchabilities.keys - %w(public_unlisted)
end
def favourites_map(status_ids, account_id)
@ -526,7 +526,7 @@ class Status < ApplicationRecord
def set_searchability
return if searchability.nil?
self.searchability = [Status.searchabilities[searchability], Status.visibilities[visibility == 'public_unlisted' ? 'public' : visibility]].max
self.searchability = [Status.searchabilities[searchability], Status.visibilities[visibility == 'public_unlisted' || visibility == 'login' ? 'public' : visibility]].max
end
def set_conversation

View file

@ -32,6 +32,7 @@ class TagFeed < PublicFeed
scope.merge!(remote_only_scope) if remote_only?
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
scope.merge!(anonymous_scope) unless account?
scope.cache_ids.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
end

View file

@ -37,6 +37,7 @@ class UserSettings
setting :use_system_font, default: false
setting :disable_swiping, default: false
setting :delete_modal, default: true
setting :enable_login_privacy, default: false
setting :reblog_modal, default: false
setting :unfollow_modal, default: true
setting :reduce_motion, default: false