Merge commit '69db507924
' into kb_migration
This commit is contained in:
commit
f8cd77b8b1
276 changed files with 3984 additions and 3972 deletions
|
@ -32,33 +32,26 @@ class AccountConversation < ApplicationRecord
|
|||
end
|
||||
|
||||
def participant_accounts
|
||||
@participant_accounts ||= begin
|
||||
if participant_account_ids.empty?
|
||||
[account]
|
||||
else
|
||||
participants = Account.where(id: participant_account_ids).to_a
|
||||
participants.empty? ? [account] : participants
|
||||
end
|
||||
end
|
||||
@participant_accounts ||= Account.where(id: participant_account_ids).to_a
|
||||
@participant_accounts.presence || [account]
|
||||
end
|
||||
|
||||
class << self
|
||||
def to_a_paginated_by_id(limit, min_id: nil, max_id: nil, since_id: nil, preload_participants: true)
|
||||
def to_a_paginated_by_id(limit, options = {})
|
||||
array = begin
|
||||
if min_id
|
||||
paginate_by_min_id(limit, min_id, max_id).reverse
|
||||
if options[:min_id]
|
||||
paginate_by_min_id(limit, options[:min_id], options[:max_id]).reverse
|
||||
else
|
||||
paginate_by_max_id(limit, max_id, since_id).to_a
|
||||
paginate_by_max_id(limit, options[:max_id], options[:since_id]).to_a
|
||||
end
|
||||
end
|
||||
|
||||
if preload_participants
|
||||
participant_ids = array.flat_map(&:participant_account_ids)
|
||||
accounts_by_id = Account.where(id: participant_ids).index_by(&:id)
|
||||
# Preload participants
|
||||
participant_ids = array.flat_map(&:participant_account_ids)
|
||||
accounts_by_id = Account.where(id: participant_ids).index_by(&:id)
|
||||
|
||||
array.each do |conversation|
|
||||
conversation.participant_accounts = conversation.participant_account_ids.filter_map { |id| accounts_by_id[id] }
|
||||
end
|
||||
array.each do |conversation|
|
||||
conversation.participant_accounts = conversation.participant_account_ids.filter_map { |id| accounts_by_id[id] }
|
||||
end
|
||||
|
||||
array
|
||||
|
|
|
@ -26,6 +26,7 @@ class Admin::AccountAction
|
|||
alias include_statuses? include_statuses
|
||||
|
||||
validates :type, :target_account, :current_account, presence: true
|
||||
validates :type, inclusion: { in: TYPES }
|
||||
|
||||
def initialize(attributes = {})
|
||||
@send_email_notification = true
|
||||
|
@ -71,6 +72,10 @@ class Admin::AccountAction
|
|||
TYPES - %w(none disable)
|
||||
end
|
||||
end
|
||||
|
||||
def i18n_scope
|
||||
:activerecord
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -48,6 +48,7 @@ class Report < ApplicationRecord
|
|||
|
||||
validate :validate_rule_ids
|
||||
|
||||
# entries here needs to be kept in sync with app/javascript/mastodon/features/notifications/components/report.jsx
|
||||
enum category: {
|
||||
other: 0,
|
||||
spam: 1_000,
|
||||
|
|
|
@ -18,9 +18,9 @@ class UserSettings
|
|||
setting :show_application, default: true
|
||||
setting :default_language, default: nil
|
||||
setting :default_sensitive, default: false
|
||||
setting :default_privacy, default: nil
|
||||
setting :default_privacy, default: nil, in: %w(public public_unlisted login unlisted private)
|
||||
setting :default_reblog_privacy, default: nil
|
||||
setting :default_searchability, default: :direct
|
||||
setting :default_searchability, default: :direct, in: %w(public private direct limited)
|
||||
setting :public_post_to_unlisted, default: false
|
||||
setting :reject_public_unlisted_subscription, default: false
|
||||
setting :reject_unlisted_subscription, default: false
|
||||
|
@ -88,7 +88,10 @@ class UserSettings
|
|||
|
||||
raise KeyError, "Undefined setting: #{key}" unless self.class.definition_for?(key)
|
||||
|
||||
typecast_value = self.class.definition_for(key).type_cast(value)
|
||||
setting_definition = self.class.definition_for(key)
|
||||
typecast_value = setting_definition.type_cast(value)
|
||||
|
||||
raise ArgumentError, "Invalid value for setting #{key}: #{typecast_value}" if setting_definition.in.present? && setting_definition.in.exclude?(typecast_value)
|
||||
|
||||
if typecast_value.nil?
|
||||
@original_hash.delete(key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue