mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Autofix Rubocop remaining Layout rules (#23679)
This commit is contained in:
parent
d2dcb6c45a
commit
717683d1c3
@ -14,154 +14,6 @@ Bundler/OrderedGems:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'Gemfile'
|
- 'Gemfile'
|
||||||
|
|
||||||
# Offense count: 81
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/EmptyLineAfterGuardClause:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/api/v1/tags_controller.rb'
|
|
||||||
- 'app/controllers/application_controller.rb'
|
|
||||||
- 'app/controllers/concerns/session_tracking_concern.rb'
|
|
||||||
- 'app/controllers/concerns/signature_verification.rb'
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'app/lib/activitypub/activity.rb'
|
|
||||||
- 'app/lib/activitypub/tag_manager.rb'
|
|
||||||
- 'app/lib/request.rb'
|
|
||||||
- 'app/lib/settings/scoped_settings.rb'
|
|
||||||
- 'app/lib/status_filter.rb'
|
|
||||||
- 'app/lib/tag_manager.rb'
|
|
||||||
- 'app/lib/webfinger.rb'
|
|
||||||
- 'app/models/account.rb'
|
|
||||||
- 'app/models/account_conversation.rb'
|
|
||||||
- 'app/models/admin/import.rb'
|
|
||||||
- 'app/models/custom_filter.rb'
|
|
||||||
- 'app/models/favourite.rb'
|
|
||||||
- 'app/models/form/admin_settings.rb'
|
|
||||||
- 'app/models/poll.rb'
|
|
||||||
- 'app/models/session_activation.rb'
|
|
||||||
- 'app/models/setting.rb'
|
|
||||||
- 'app/models/status_edit.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'app/models/user_role.rb'
|
|
||||||
- 'app/services/activitypub/fetch_remote_actor_service.rb'
|
|
||||||
- 'app/services/activitypub/fetch_remote_status_service.rb'
|
|
||||||
- 'app/services/activitypub/fetch_replies_service.rb'
|
|
||||||
- 'app/services/activitypub/process_account_service.rb'
|
|
||||||
- 'app/services/favourite_service.rb'
|
|
||||||
- 'app/services/notify_service.rb'
|
|
||||||
- 'app/services/post_status_service.rb'
|
|
||||||
- 'app/services/vote_service.rb'
|
|
||||||
- 'app/validators/follow_limit_validator.rb'
|
|
||||||
- 'app/validators/unreserved_username_validator.rb'
|
|
||||||
- 'app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb'
|
|
||||||
- 'db/migrate/20190314181829_migrate_open_registrations_setting.rb'
|
|
||||||
- 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb'
|
|
||||||
- 'db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb'
|
|
||||||
- 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb'
|
|
||||||
- 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb'
|
|
||||||
- 'lib/mastodon/domains_cli.rb'
|
|
||||||
|
|
||||||
# Offense count: 71
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/EmptyLineAfterMagicComment:
|
|
||||||
Exclude:
|
|
||||||
- 'Capfile'
|
|
||||||
- 'app/helpers/languages_helper.rb'
|
|
||||||
- 'app/models/account.rb'
|
|
||||||
- 'app/models/account_conversation.rb'
|
|
||||||
- 'app/models/account_domain_block.rb'
|
|
||||||
- 'app/models/account_moderation_note.rb'
|
|
||||||
- 'app/models/account_note.rb'
|
|
||||||
- 'app/models/account_pin.rb'
|
|
||||||
- 'app/models/account_stat.rb'
|
|
||||||
- 'app/models/account_summary.rb'
|
|
||||||
- 'app/models/account_warning.rb'
|
|
||||||
- 'app/models/backup.rb'
|
|
||||||
- 'app/models/block.rb'
|
|
||||||
- 'app/models/bookmark.rb'
|
|
||||||
- 'app/models/canonical_email_block.rb'
|
|
||||||
- 'app/models/conversation.rb'
|
|
||||||
- 'app/models/conversation_mute.rb'
|
|
||||||
- 'app/models/custom_emoji.rb'
|
|
||||||
- 'app/models/custom_filter.rb'
|
|
||||||
- 'app/models/custom_filter_keyword.rb'
|
|
||||||
- 'app/models/custom_filter_status.rb'
|
|
||||||
- 'app/models/device.rb'
|
|
||||||
- 'app/models/domain_block.rb'
|
|
||||||
- 'app/models/email_domain_block.rb'
|
|
||||||
- 'app/models/encrypted_message.rb'
|
|
||||||
- 'app/models/favourite.rb'
|
|
||||||
- 'app/models/featured_tag.rb'
|
|
||||||
- 'app/models/follow.rb'
|
|
||||||
- 'app/models/follow_recommendation.rb'
|
|
||||||
- 'app/models/follow_recommendation_suppression.rb'
|
|
||||||
- 'app/models/follow_request.rb'
|
|
||||||
- 'app/models/identity.rb'
|
|
||||||
- 'app/models/import.rb'
|
|
||||||
- 'app/models/instance.rb'
|
|
||||||
- 'app/models/invite.rb'
|
|
||||||
- 'app/models/ip_block.rb'
|
|
||||||
- 'app/models/list.rb'
|
|
||||||
- 'app/models/list_account.rb'
|
|
||||||
- 'app/models/login_activity.rb'
|
|
||||||
- 'app/models/media_attachment.rb'
|
|
||||||
- 'app/models/mention.rb'
|
|
||||||
- 'app/models/mute.rb'
|
|
||||||
- 'app/models/notification.rb'
|
|
||||||
- 'app/models/one_time_key.rb'
|
|
||||||
- 'app/models/poll.rb'
|
|
||||||
- 'app/models/poll_vote.rb'
|
|
||||||
- 'app/models/preview_card.rb'
|
|
||||||
- 'app/models/preview_card_provider.rb'
|
|
||||||
- 'app/models/relay.rb'
|
|
||||||
- 'app/models/report.rb'
|
|
||||||
- 'app/models/report_note.rb'
|
|
||||||
- 'app/models/session_activation.rb'
|
|
||||||
- 'app/models/setting.rb'
|
|
||||||
- 'app/models/site_upload.rb'
|
|
||||||
- 'app/models/status.rb'
|
|
||||||
- 'app/models/status_edit.rb'
|
|
||||||
- 'app/models/status_pin.rb'
|
|
||||||
- 'app/models/status_stat.rb'
|
|
||||||
- 'app/models/tag.rb'
|
|
||||||
- 'app/models/unavailable_domain.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'app/models/user_ip.rb'
|
|
||||||
- 'app/models/web/push_subscription.rb'
|
|
||||||
- 'app/models/web/setting.rb'
|
|
||||||
- 'app/models/webauthn_credential.rb'
|
|
||||||
- 'config.ru'
|
|
||||||
- 'db/migrate/20220613110834_add_action_to_custom_filters.rb'
|
|
||||||
- 'db/post_migrate/20220613110802_remove_whole_word_from_custom_filters.rb'
|
|
||||||
- 'db/post_migrate/20220613110903_remove_irreversible_from_custom_filters.rb'
|
|
||||||
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb'
|
|
||||||
- 'spec/models/tag_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 113
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
||||||
# SupportedHashRocketStyles: key, separator, table
|
|
||||||
# SupportedColonStyles: key, separator, table
|
|
||||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
||||||
Layout/HashAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/lib/activitypub/linked_data_signature.rb'
|
|
||||||
- 'app/lib/ostatus/tag_manager.rb'
|
|
||||||
- 'app/models/account/field.rb'
|
|
||||||
- 'app/models/account_warning.rb'
|
|
||||||
- 'app/models/media_attachment.rb'
|
|
||||||
- 'app/models/notification.rb'
|
|
||||||
- 'app/models/poll.rb'
|
|
||||||
- 'app/presenters/account_relationships_presenter.rb'
|
|
||||||
- 'app/services/keys/claim_service.rb'
|
|
||||||
- 'app/services/keys/query_service.rb'
|
|
||||||
- 'app/workers/web/push_notification_worker.rb'
|
|
||||||
- 'db/post_migrate/20200917193528_migrate_notifications_type.rb'
|
|
||||||
- 'lib/sanitize_ext/sanitize_config.rb'
|
|
||||||
- 'lib/tasks/auto_annotate_models.rake'
|
|
||||||
- 'lib/tasks/mastodon.rake'
|
|
||||||
- 'spec/models/admin/account_action_spec.rb'
|
|
||||||
- 'spec/models/concerns/account_interactions_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 581
|
# Offense count: 581
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||||
|
1
Capfile
1
Capfile
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'capistrano/setup'
|
require 'capistrano/setup'
|
||||||
require 'capistrano/deploy'
|
require 'capistrano/deploy'
|
||||||
require 'capistrano/scm/git'
|
require 'capistrano/scm/git'
|
||||||
|
@ -25,6 +25,7 @@ class Api::V1::TagsController < Api::BaseController
|
|||||||
|
|
||||||
def set_or_create_tag
|
def set_or_create_tag
|
||||||
return not_found unless Tag::HASHTAG_NAME_RE.match?(params[:id])
|
return not_found unless Tag::HASHTAG_NAME_RE.match?(params[:id])
|
||||||
|
|
||||||
@tag = Tag.find_normalized(params[:id]) || Tag.new(name: Tag.normalize(params[:id]), display_name: params[:id])
|
@tag = Tag.find_normalized(params[:id]) || Tag.new(name: Tag.normalize(params[:id]), display_name: params[:id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -128,6 +128,7 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def current_theme
|
def current_theme
|
||||||
return Setting.theme unless Themes.instance.names.include? current_user&.setting_theme
|
return Setting.theme unless Themes.instance.names.include? current_user&.setting_theme
|
||||||
|
|
||||||
current_user.setting_theme
|
current_user.setting_theme
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ module SessionTrackingConcern
|
|||||||
|
|
||||||
def set_session_activity
|
def set_session_activity
|
||||||
return unless session_needs_update?
|
return unless session_needs_update?
|
||||||
|
|
||||||
current_session.touch
|
current_session.touch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ module SignatureVerification
|
|||||||
end
|
end
|
||||||
|
|
||||||
raise SignatureVerificationError, "Invalid Digest value. The provided Digest value is not a SHA-256 digest. Given digest: #{sha256[1]}" if digest_size != 32
|
raise SignatureVerificationError, "Invalid Digest value. The provided Digest value is not a SHA-256 digest. Given digest: #{sha256[1]}" if digest_size != 32
|
||||||
|
|
||||||
raise SignatureVerificationError, "Invalid Digest value. Computed SHA-256 digest: #{body_digest}; given: #{sha256[1]}"
|
raise SignatureVerificationError, "Invalid Digest value. Computed SHA-256 digest: #{body_digest}; given: #{sha256[1]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ module ApplicationHelper
|
|||||||
|
|
||||||
def can?(action, record)
|
def can?(action, record)
|
||||||
return false if record.nil?
|
return false if record.nil?
|
||||||
|
|
||||||
policy(record).public_send("#{action}?")
|
policy(record).public_send("#{action}?")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# rubocop:disable Metrics/ModuleLength, Style/WordArray
|
# rubocop:disable Metrics/ModuleLength, Style/WordArray
|
||||||
|
|
||||||
module LanguagesHelper
|
module LanguagesHelper
|
||||||
|
@ -153,6 +153,7 @@ class ActivityPub::Activity
|
|||||||
def fetch_remote_original_status
|
def fetch_remote_original_status
|
||||||
if object_uri.start_with?('http')
|
if object_uri.start_with?('http')
|
||||||
return if ActivityPub::TagManager.instance.local_uri?(object_uri)
|
return if ActivityPub::TagManager.instance.local_uri?(object_uri)
|
||||||
|
|
||||||
ActivityPub::FetchRemoteStatusService.new.call(object_uri, id: true, on_behalf_of: @account.followers.local.first, request_id: @options[:request_id])
|
ActivityPub::FetchRemoteStatusService.new.call(object_uri, id: true, on_behalf_of: @account.followers.local.first, request_id: @options[:request_id])
|
||||||
elsif @object['url'].present?
|
elsif @object['url'].present?
|
||||||
::FetchRemoteStatusService.new.call(@object['url'], request_id: @options[:request_id])
|
::FetchRemoteStatusService.new.call(@object['url'], request_id: @options[:request_id])
|
||||||
|
@ -26,6 +26,7 @@ class ActivityPub::TagManager
|
|||||||
target.instance_actor? ? about_more_url(instance_actor: true) : short_account_url(target)
|
target.instance_actor? ? about_more_url(instance_actor: true) : short_account_url(target)
|
||||||
when :note, :comment, :activity
|
when :note, :comment, :activity
|
||||||
return activity_account_status_url(target.account, target) if target.reblog?
|
return activity_account_status_url(target.account, target) if target.reblog?
|
||||||
|
|
||||||
short_account_status_url(target.account, target)
|
short_account_status_url(target.account, target)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -38,6 +39,7 @@ class ActivityPub::TagManager
|
|||||||
target.instance_actor? ? instance_actor_url : account_url(target)
|
target.instance_actor? ? instance_actor_url : account_url(target)
|
||||||
when :note, :comment, :activity
|
when :note, :comment, :activity
|
||||||
return activity_account_status_url(target.account, target) if target.reblog?
|
return activity_account_status_url(target.account, target) if target.reblog?
|
||||||
|
|
||||||
account_status_url(target.account, target)
|
account_status_url(target.account, target)
|
||||||
when :emoji
|
when :emoji
|
||||||
emoji_url(target)
|
emoji_url(target)
|
||||||
|
@ -182,6 +182,7 @@ class Request
|
|||||||
|
|
||||||
contents = truncated_body(limit)
|
contents = truncated_body(limit)
|
||||||
raise Mastodon::LengthValidationError if contents.bytesize > limit
|
raise Mastodon::LengthValidationError if contents.bytesize > limit
|
||||||
|
|
||||||
contents
|
contents
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -34,6 +34,7 @@ module Settings
|
|||||||
|
|
||||||
Setting.default_settings.each do |key, default_value|
|
Setting.default_settings.each do |key, default_value|
|
||||||
next if records.key?(key) || default_value.is_a?(Hash)
|
next if records.key?(key) || default_value.is_a?(Hash)
|
||||||
|
|
||||||
records[key] = Setting.new(var: key, value: default_value)
|
records[key] = Setting.new(var: key, value: default_value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ module Settings
|
|||||||
if db_val
|
if db_val
|
||||||
default_value = ScopedSettings.default_settings[key]
|
default_value = ScopedSettings.default_settings[key]
|
||||||
return default_value.with_indifferent_access.merge!(db_val.value) if default_value.is_a?(Hash)
|
return default_value.with_indifferent_access.merge!(db_val.value) if default_value.is_a?(Hash)
|
||||||
|
|
||||||
db_val.value
|
db_val.value
|
||||||
else
|
else
|
||||||
ScopedSettings.default_settings[key]
|
ScopedSettings.default_settings[key]
|
||||||
|
@ -11,6 +11,7 @@ class StatusFilter
|
|||||||
|
|
||||||
def filtered?
|
def filtered?
|
||||||
return false if !account.nil? && account.id == status.account_id
|
return false if !account.nil? && account.id == status.account_id
|
||||||
|
|
||||||
blocked_by_policy? || (account_present? && filtered_status?) || silenced_account?
|
blocked_by_policy? || (account_present? && filtered_status?) || silenced_account?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ class TagManager
|
|||||||
def local_url?(url)
|
def local_url?(url)
|
||||||
uri = Addressable::URI.parse(url).normalize
|
uri = Addressable::URI.parse(url).normalize
|
||||||
return false unless uri.host
|
return false unless uri.host
|
||||||
|
|
||||||
domain = uri.host + (uri.port ? ":#{uri.port}" : '')
|
domain = uri.host + (uri.port ? ":#{uri.port}" : '')
|
||||||
|
|
||||||
TagManager.instance.web_domain?(domain)
|
TagManager.instance.web_domain?(domain)
|
||||||
|
@ -57,6 +57,7 @@ class Webfinger
|
|||||||
if res.code == 200
|
if res.code == 200
|
||||||
body = res.body_with_limit
|
body = res.body_with_limit
|
||||||
raise Webfinger::Error, "Request for #{@uri} returned empty response" if body.empty?
|
raise Webfinger::Error, "Request for #{@uri} returned empty response" if body.empty?
|
||||||
|
|
||||||
body
|
body
|
||||||
elsif res.code == 404 && use_fallback
|
elsif res.code == 404 && use_fallback
|
||||||
body_from_host_meta
|
body_from_host_meta
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: accounts
|
# Table name: accounts
|
||||||
@ -539,6 +540,7 @@ class Account < ApplicationRecord
|
|||||||
|
|
||||||
def ensure_keys!
|
def ensure_keys!
|
||||||
return unless local? && private_key.blank? && public_key.blank?
|
return unless local? && private_key.blank? && public_key.blank?
|
||||||
|
|
||||||
generate_keys
|
generate_keys
|
||||||
save!
|
save!
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_conversations
|
# Table name: account_conversations
|
||||||
@ -107,6 +108,7 @@ class AccountConversation < ApplicationRecord
|
|||||||
|
|
||||||
def push_to_streaming_api
|
def push_to_streaming_api
|
||||||
return if destroyed? || !subscribed_to_timeline?
|
return if destroyed? || !subscribed_to_timeline?
|
||||||
|
|
||||||
PushConversationWorker.perform_async(id)
|
PushConversationWorker.perform_async(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_domain_blocks
|
# Table name: account_domain_blocks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_moderation_notes
|
# Table name: account_moderation_notes
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_notes
|
# Table name: account_notes
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_pins
|
# Table name: account_pins
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_stats
|
# Table name: account_stats
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_summaries
|
# Table name: account_summaries
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: account_warnings
|
# Table name: account_warnings
|
||||||
|
@ -56,6 +56,7 @@ class Admin::Import
|
|||||||
|
|
||||||
def validate_data
|
def validate_data
|
||||||
return if data.nil?
|
return if data.nil?
|
||||||
|
|
||||||
errors.add(:data, I18n.t('imports.errors.over_rows_processing_limit', count: ROWS_PROCESSING_LIMIT)) if csv_row_count > ROWS_PROCESSING_LIMIT
|
errors.add(:data, I18n.t('imports.errors.over_rows_processing_limit', count: ROWS_PROCESSING_LIMIT)) if csv_row_count > ROWS_PROCESSING_LIMIT
|
||||||
rescue CSV::MalformedCSVError => e
|
rescue CSV::MalformedCSVError => e
|
||||||
errors.add(:data, I18n.t('imports.errors.invalid_csv_file', error: e.message))
|
errors.add(:data, I18n.t('imports.errors.invalid_csv_file', error: e.message))
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: backups
|
# Table name: backups
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: blocks
|
# Table name: blocks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: bookmarks
|
# Table name: bookmarks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: canonical_email_blocks
|
# Table name: canonical_email_blocks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: conversations
|
# Table name: conversations
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: conversation_mutes
|
# Table name: conversation_mutes
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: custom_emojis
|
# Table name: custom_emojis
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: custom_filters
|
# Table name: custom_filters
|
||||||
@ -101,6 +102,7 @@ class CustomFilter < ApplicationRecord
|
|||||||
status_matches = [status.id, status.reblog_of_id].compact & rules[:status_ids] if rules[:status_ids].present?
|
status_matches = [status.id, status.reblog_of_id].compact & rules[:status_ids] if rules[:status_ids].present?
|
||||||
|
|
||||||
next if keyword_matches.blank? && status_matches.blank?
|
next if keyword_matches.blank? && status_matches.blank?
|
||||||
|
|
||||||
FilterResultPresenter.new(filter: filter, keyword_matches: keyword_matches, status_matches: status_matches)
|
FilterResultPresenter.new(filter: filter, keyword_matches: keyword_matches, status_matches: status_matches)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -111,6 +113,7 @@ class CustomFilter < ApplicationRecord
|
|||||||
|
|
||||||
def invalidate_cache!
|
def invalidate_cache!
|
||||||
return unless @should_invalidate_cache
|
return unless @should_invalidate_cache
|
||||||
|
|
||||||
@should_invalidate_cache = false
|
@should_invalidate_cache = false
|
||||||
|
|
||||||
Rails.cache.delete("filters:v3:#{account_id}")
|
Rails.cache.delete("filters:v3:#{account_id}")
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: custom_filter_keywords
|
# Table name: custom_filter_keywords
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: custom_filter_statuses
|
# Table name: custom_filter_statuses
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: devices
|
# Table name: devices
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: domain_blocks
|
# Table name: domain_blocks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: email_domain_blocks
|
# Table name: email_domain_blocks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: encrypted_messages
|
# Table name: encrypted_messages
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: favourites
|
# Table name: favourites
|
||||||
@ -38,6 +39,7 @@ class Favourite < ApplicationRecord
|
|||||||
|
|
||||||
def decrement_cache_counters
|
def decrement_cache_counters
|
||||||
return if association(:status).loaded? && status.marked_for_destruction?
|
return if association(:status).loaded? && status.marked_for_destruction?
|
||||||
|
|
||||||
status&.decrement_count!(:favourites_count)
|
status&.decrement_count!(:favourites_count)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: featured_tags
|
# Table name: featured_tags
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: follows
|
# Table name: follows
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: follow_recommendations
|
# Table name: follow_recommendations
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: follow_recommendation_suppressions
|
# Table name: follow_recommendation_suppressions
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: follow_requests
|
# Table name: follow_requests
|
||||||
|
@ -128,6 +128,7 @@ class Form::AdminSettings
|
|||||||
def validate_site_uploads
|
def validate_site_uploads
|
||||||
UPLOAD_KEYS.each do |key|
|
UPLOAD_KEYS.each do |key|
|
||||||
next unless instance_variable_defined?("@#{key}")
|
next unless instance_variable_defined?("@#{key}")
|
||||||
|
|
||||||
upload = instance_variable_get("@#{key}")
|
upload = instance_variable_get("@#{key}")
|
||||||
next if upload.valid?
|
next if upload.valid?
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: identities
|
# Table name: identities
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: imports
|
# Table name: imports
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: instances
|
# Table name: instances
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: invites
|
# Table name: invites
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: ip_blocks
|
# Table name: ip_blocks
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: lists
|
# Table name: lists
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: list_accounts
|
# Table name: list_accounts
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: login_activities
|
# Table name: login_activities
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: media_attachments
|
# Table name: media_attachments
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: mentions
|
# Table name: mentions
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: mutes
|
# Table name: mutes
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: notifications
|
# Table name: notifications
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: one_time_keys
|
# Table name: one_time_keys
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: polls
|
# Table name: polls
|
||||||
@ -105,6 +106,7 @@ class Poll < ApplicationRecord
|
|||||||
|
|
||||||
def reset_parent_cache
|
def reset_parent_cache
|
||||||
return if status_id.nil?
|
return if status_id.nil?
|
||||||
|
|
||||||
Rails.cache.delete("statuses/#{status_id}")
|
Rails.cache.delete("statuses/#{status_id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: poll_votes
|
# Table name: poll_votes
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: preview_cards
|
# Table name: preview_cards
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: preview_card_providers
|
# Table name: preview_card_providers
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: relays
|
# Table name: relays
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: reports
|
# Table name: reports
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: report_notes
|
# Table name: report_notes
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: session_activations
|
# Table name: session_activations
|
||||||
@ -51,6 +52,7 @@ class SessionActivation < ApplicationRecord
|
|||||||
|
|
||||||
def deactivate(id)
|
def deactivate(id)
|
||||||
return unless id
|
return unless id
|
||||||
|
|
||||||
where(session_id: id).destroy_all
|
where(session_id: id).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: settings
|
# Table name: settings
|
||||||
@ -30,6 +31,7 @@ class Setting < RailsSettings::Base
|
|||||||
default_value = default_settings[key]
|
default_value = default_settings[key]
|
||||||
|
|
||||||
return default_value.with_indifferent_access.merge!(db_val.value) if default_value.is_a?(Hash)
|
return default_value.with_indifferent_access.merge!(db_val.value) if default_value.is_a?(Hash)
|
||||||
|
|
||||||
db_val.value
|
db_val.value
|
||||||
else
|
else
|
||||||
default_settings[key]
|
default_settings[key]
|
||||||
@ -43,6 +45,7 @@ class Setting < RailsSettings::Base
|
|||||||
|
|
||||||
default_settings.each do |key, default_value|
|
default_settings.each do |key, default_value|
|
||||||
next if records.key?(key) || default_value.is_a?(Hash)
|
next if records.key?(key) || default_value.is_a?(Hash)
|
||||||
|
|
||||||
records[key] = Setting.new(var: key, value: default_value)
|
records[key] = Setting.new(var: key, value: default_value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,6 +54,7 @@ class Setting < RailsSettings::Base
|
|||||||
|
|
||||||
def default_settings
|
def default_settings
|
||||||
return {} unless RailsSettings::Default.enabled?
|
return {} unless RailsSettings::Default.enabled?
|
||||||
|
|
||||||
RailsSettings::Default.instance
|
RailsSettings::Default.instance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: site_uploads
|
# Table name: site_uploads
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: statuses
|
# Table name: statuses
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: status_edits
|
# Table name: status_edits
|
||||||
@ -45,6 +46,7 @@ class StatusEdit < ApplicationRecord
|
|||||||
|
|
||||||
def emojis
|
def emojis
|
||||||
return @emojis if defined?(@emojis)
|
return @emojis if defined?(@emojis)
|
||||||
|
|
||||||
@emojis = CustomEmoji.from_text([spoiler_text, text].join(' '), status.account.domain)
|
@emojis = CustomEmoji.from_text([spoiler_text, text].join(' '), status.account.domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: status_pins
|
# Table name: status_pins
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: status_stats
|
# Table name: status_stats
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: tags
|
# Table name: tags
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: unavailable_domains
|
# Table name: unavailable_domains
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: users
|
# Table name: users
|
||||||
@ -492,12 +493,14 @@ class User < ApplicationRecord
|
|||||||
|
|
||||||
def sanitize_languages
|
def sanitize_languages
|
||||||
return if chosen_languages.nil?
|
return if chosen_languages.nil?
|
||||||
|
|
||||||
chosen_languages.reject!(&:blank?)
|
chosen_languages.reject!(&:blank?)
|
||||||
self.chosen_languages = nil if chosen_languages.empty?
|
self.chosen_languages = nil if chosen_languages.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def sanitize_role
|
def sanitize_role
|
||||||
return if role.nil?
|
return if role.nil?
|
||||||
|
|
||||||
self.role = nil if role.everyone?
|
self.role = nil if role.everyone?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -516,6 +519,7 @@ class User < ApplicationRecord
|
|||||||
def notify_staff_about_pending_account!
|
def notify_staff_about_pending_account!
|
||||||
User.those_who_can(:manage_users).includes(:account).find_each do |u|
|
User.those_who_can(:manage_users).includes(:account).find_each do |u|
|
||||||
next unless u.allows_pending_account_emails?
|
next unless u.allows_pending_account_emails?
|
||||||
|
|
||||||
AdminMailer.new_pending_account(u.account, self).deliver_later
|
AdminMailer.new_pending_account(u.account, self).deliver_later
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: user_ips
|
# Table name: user_ips
|
||||||
|
@ -163,6 +163,7 @@ class UserRole < ApplicationRecord
|
|||||||
|
|
||||||
def in_permissions?(privilege)
|
def in_permissions?(privilege)
|
||||||
raise ArgumentError, "Unknown privilege: #{privilege}" unless FLAGS.key?(privilege)
|
raise ArgumentError, "Unknown privilege: #{privilege}" unless FLAGS.key?(privilege)
|
||||||
|
|
||||||
computed_permissions & FLAGS[privilege] == FLAGS[privilege]
|
computed_permissions & FLAGS[privilege] == FLAGS[privilege]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -172,6 +173,7 @@ class UserRole < ApplicationRecord
|
|||||||
|
|
||||||
def validate_own_role_edition
|
def validate_own_role_edition
|
||||||
return unless defined?(@current_account) && @current_account.user_role.id == id
|
return unless defined?(@current_account) && @current_account.user_role.id == id
|
||||||
|
|
||||||
errors.add(:permissions_as_keys, :own_role) if permissions_changed?
|
errors.add(:permissions_as_keys, :own_role) if permissions_changed?
|
||||||
errors.add(:position, :own_role) if position_changed?
|
errors.add(:position, :own_role) if position_changed?
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: web_push_subscriptions
|
# Table name: web_push_subscriptions
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: web_settings
|
# Table name: web_settings
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: webauthn_credentials
|
# Table name: webauthn_credentials
|
||||||
|
@ -50,6 +50,7 @@ class ActivityPub::FetchRemoteActorService < BaseService
|
|||||||
|
|
||||||
if @username.casecmp(confirmed_username).zero? && @domain.casecmp(confirmed_domain).zero?
|
if @username.casecmp(confirmed_username).zero? && @domain.casecmp(confirmed_domain).zero?
|
||||||
raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.link('self', 'href') != @uri
|
raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.link('self', 'href') != @uri
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService
|
|||||||
|
|
||||||
def trustworthy_attribution?(uri, attributed_to)
|
def trustworthy_attribution?(uri, attributed_to)
|
||||||
return false if uri.nil? || attributed_to.nil?
|
return false if uri.nil? || attributed_to.nil?
|
||||||
|
|
||||||
Addressable::URI.parse(uri).normalized_host.casecmp(Addressable::URI.parse(attributed_to).normalized_host).zero?
|
Addressable::URI.parse(uri).normalized_host.casecmp(Addressable::URI.parse(attributed_to).normalized_host).zero?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ class ActivityPub::FetchRepliesService < BaseService
|
|||||||
return collection_or_uri if collection_or_uri.is_a?(Hash)
|
return collection_or_uri if collection_or_uri.is_a?(Hash)
|
||||||
return unless @allow_synchronous_requests
|
return unless @allow_synchronous_requests
|
||||||
return if invalid_origin?(collection_or_uri)
|
return if invalid_origin?(collection_or_uri)
|
||||||
|
|
||||||
fetch_resource_without_id_validation(collection_or_uri, nil, true)
|
fetch_resource_without_id_validation(collection_or_uri, nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -226,6 +226,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||||||
|
|
||||||
def property_values
|
def property_values
|
||||||
return unless @json['attachment'].is_a?(Array)
|
return unless @json['attachment'].is_a?(Array)
|
||||||
|
|
||||||
as_array(@json['attachment']).select { |attachment| attachment['type'] == 'PropertyValue' }.map { |attachment| attachment.slice('name', 'value') }
|
as_array(@json['attachment']).select { |attachment| attachment['type'] == 'PropertyValue' }.map { |attachment| attachment.slice('name', 'value') }
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -289,6 +290,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||||||
|
|
||||||
def domain_block
|
def domain_block
|
||||||
return @domain_block if defined?(@domain_block)
|
return @domain_block if defined?(@domain_block)
|
||||||
|
|
||||||
@domain_block = DomainBlock.rule_for(@domain)
|
@domain_block = DomainBlock.rule_for(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ class FavouriteService < BaseService
|
|||||||
def bump_potential_friendship(account, status)
|
def bump_potential_friendship(account, status)
|
||||||
ActivityTracker.increment('activity:interactions')
|
ActivityTracker.increment('activity:interactions')
|
||||||
return if account.following?(status.account_id)
|
return if account.following?(status.account_id)
|
||||||
|
|
||||||
PotentialFriendshipTracker.record(account.id, status.account_id, :favourite)
|
PotentialFriendshipTracker.record(account.id, status.account_id, :favourite)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class NotifyService < BaseService
|
|||||||
|
|
||||||
def following_sender?
|
def following_sender?
|
||||||
return @following_sender if defined?(@following_sender)
|
return @following_sender if defined?(@following_sender)
|
||||||
|
|
||||||
@following_sender = @recipient.following?(@notification.from_account) || @recipient.requested?(@notification.from_account)
|
@following_sender = @recipient.following?(@notification.from_account) || @recipient.requested?(@notification.from_account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ class PostStatusService < BaseService
|
|||||||
|
|
||||||
def safeguard_mentions!(status)
|
def safeguard_mentions!(status)
|
||||||
return if @options[:allowed_mentions].nil?
|
return if @options[:allowed_mentions].nil?
|
||||||
|
|
||||||
expected_account_ids = @options[:allowed_mentions].map(&:to_i)
|
expected_account_ids = @options[:allowed_mentions].map(&:to_i)
|
||||||
|
|
||||||
unexpected_accounts = status.mentions.map(&:account).to_a.reject { |mentioned_account| expected_account_ids.include?(mentioned_account.id) }
|
unexpected_accounts = status.mentions.map(&:account).to_a.reject { |mentioned_account| expected_account_ids.include?(mentioned_account.id) }
|
||||||
@ -175,8 +176,10 @@ class PostStatusService < BaseService
|
|||||||
|
|
||||||
def bump_potential_friendship!
|
def bump_potential_friendship!
|
||||||
return if !@status.reply? || @account.id == @status.in_reply_to_account_id
|
return if !@status.reply? || @account.id == @status.in_reply_to_account_id
|
||||||
|
|
||||||
ActivityTracker.increment('activity:interactions')
|
ActivityTracker.increment('activity:interactions')
|
||||||
return if @account.following?(@status.in_reply_to_account_id)
|
return if @account.following?(@status.in_reply_to_account_id)
|
||||||
|
|
||||||
PotentialFriendshipTracker.record(@account.id, @status.in_reply_to_account_id, :reply)
|
PotentialFriendshipTracker.record(@account.id, @status.in_reply_to_account_id, :reply)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,11 +44,13 @@ class VoteService < BaseService
|
|||||||
|
|
||||||
def distribute_poll!
|
def distribute_poll!
|
||||||
return if @poll.hide_totals?
|
return if @poll.hide_totals?
|
||||||
|
|
||||||
ActivityPub::DistributePollUpdateWorker.perform_in(3.minutes, @poll.status.id)
|
ActivityPub::DistributePollUpdateWorker.perform_in(3.minutes, @poll.status.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def queue_final_poll_check!
|
def queue_final_poll_check!
|
||||||
return unless @poll.expires?
|
return unless @poll.expires?
|
||||||
|
|
||||||
PollExpirationNotifyWorker.perform_at(@poll.expires_at + 5.minutes, @poll.id)
|
PollExpirationNotifyWorker.perform_at(@poll.expires_at + 5.minutes, @poll.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ class FollowLimitValidator < ActiveModel::Validator
|
|||||||
|
|
||||||
def validate(follow)
|
def validate(follow)
|
||||||
return if follow.account.nil? || !follow.account.local?
|
return if follow.account.nil? || !follow.account.local?
|
||||||
|
|
||||||
follow.errors.add(:base, I18n.t('users.follow_limit_reached', limit: self.class.limit_for_account(follow.account))) if limit_reached?(follow.account)
|
follow.errors.add(:base, I18n.t('users.follow_limit_reached', limit: self.class.limit_for_account(follow.account))) if limit_reached?(follow.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,12 +13,14 @@ class UnreservedUsernameValidator < ActiveModel::Validator
|
|||||||
|
|
||||||
def pam_controlled?
|
def pam_controlled?
|
||||||
return false unless Devise.pam_authentication && Devise.pam_controlled_service
|
return false unless Devise.pam_authentication && Devise.pam_controlled_service
|
||||||
|
|
||||||
Rpam2.account(Devise.pam_controlled_service, @username).present?
|
Rpam2.account(Devise.pam_controlled_service, @username).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def reserved_username?
|
def reserved_username?
|
||||||
return true if pam_controlled?
|
return true if pam_controlled?
|
||||||
return false unless Setting.reserved_usernames
|
return false unless Setting.reserved_usernames
|
||||||
|
|
||||||
Setting.reserved_usernames.include?(@username.downcase)
|
Setting.reserved_usernames.include?(@username.downcase)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -62,6 +62,7 @@ class Scheduler::AccountsStatusesCleanupScheduler
|
|||||||
# The idea here is to loop through all policies at least once until the budget is exhausted
|
# The idea here is to loop through all policies at least once until the budget is exhausted
|
||||||
# and start back after the last processed account otherwise
|
# and start back after the last processed account otherwise
|
||||||
break if budget.zero? || (num_processed_accounts.zero? && first_policy_id.nil?)
|
break if budget.zero? || (num_processed_accounts.zero? && first_policy_id.nil?)
|
||||||
|
|
||||||
first_policy_id = nil
|
first_policy_id = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -73,6 +74,7 @@ class Scheduler::AccountsStatusesCleanupScheduler
|
|||||||
|
|
||||||
def under_load?
|
def under_load?
|
||||||
return true if Sidekiq::Stats.new.retry_size > MAX_RETRY_SIZE
|
return true if Sidekiq::Stats.new.retry_size > MAX_RETRY_SIZE
|
||||||
|
|
||||||
queue_under_load?('default', MAX_DEFAULT_SIZE, MAX_DEFAULT_LATENCY) || queue_under_load?('push', MAX_PUSH_SIZE, MAX_PUSH_LATENCY) || queue_under_load?('pull', MAX_PULL_SIZE, MAX_PULL_LATENCY)
|
queue_under_load?('default', MAX_DEFAULT_SIZE, MAX_DEFAULT_LATENCY) || queue_under_load?('push', MAX_PUSH_SIZE, MAX_PUSH_LATENCY) || queue_under_load?('pull', MAX_PULL_SIZE, MAX_PULL_LATENCY)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# This file is used by Rack-based servers to start the application.
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
require File.expand_path('config/environment', __dir__)
|
require File.expand_path('config/environment', __dir__)
|
||||||
|
@ -2,6 +2,7 @@ class MigrateOpenRegistrationsSetting < ActiveRecord::Migration[5.2]
|
|||||||
def up
|
def up
|
||||||
open_registrations = Setting.find_by(var: 'open_registrations')
|
open_registrations = Setting.find_by(var: 'open_registrations')
|
||||||
return if open_registrations.nil? || open_registrations.value
|
return if open_registrations.nil? || open_registrations.value
|
||||||
|
|
||||||
setting = Setting.where(var: 'registrations_mode').first_or_initialize(var: 'registrations_mode')
|
setting = Setting.where(var: 'registrations_mode').first_or_initialize(var: 'registrations_mode')
|
||||||
setting.update(value: 'none')
|
setting.update(value: 'none')
|
||||||
end
|
end
|
||||||
@ -9,6 +10,7 @@ class MigrateOpenRegistrationsSetting < ActiveRecord::Migration[5.2]
|
|||||||
def down
|
def down
|
||||||
registrations_mode = Setting.find_by(var: 'registrations_mode')
|
registrations_mode = Setting.find_by(var: 'registrations_mode')
|
||||||
return if registrations_mode.nil?
|
return if registrations_mode.nil?
|
||||||
|
|
||||||
setting = Setting.where(var: 'open_registrations').first_or_initialize(var: 'open_registrations')
|
setting = Setting.where(var: 'open_registrations').first_or_initialize(var: 'open_registrations')
|
||||||
setting.update(value: registrations_mode.value == 'open')
|
setting.update(value: registrations_mode.value == 'open')
|
||||||
end
|
end
|
||||||
|
@ -8,6 +8,7 @@ class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2]
|
|||||||
|
|
||||||
User.where(User.arel_table[:current_sign_in_at].gteq(1.month.ago)).find_each do |user|
|
User.where(User.arel_table[:current_sign_in_at].gteq(1.month.ago)).find_each do |user|
|
||||||
next if Setting.unscoped.where(thing_type: 'User', thing_id: user.id, var: 'advanced_layout').exists?
|
next if Setting.unscoped.where(thing_type: 'User', thing_id: user.id, var: 'advanced_layout').exists?
|
||||||
|
|
||||||
user.settings.advanced_layout = true
|
user.settings.advanced_layout = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,6 +11,7 @@ class AddCaseInsensitiveBtreeIndexToTags < ActiveRecord::Migration[5.2]
|
|||||||
rescue ActiveRecord::StatementInvalid => e
|
rescue ActiveRecord::StatementInvalid => e
|
||||||
remove_index :tags, name: 'index_tags_on_name_lower_btree'
|
remove_index :tags, name: 'index_tags_on_name_lower_btree'
|
||||||
raise CorruptionError, 'index_tags_on_name_lower_btree' if e.is_a?(ActiveRecord::RecordNotUnique)
|
raise CorruptionError, 'index_tags_on_name_lower_btree' if e.is_a?(ActiveRecord::RecordNotUnique)
|
||||||
|
|
||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||||
|
|
||||||
class AddActionToCustomFilters < ActiveRecord::Migration[6.1]
|
class AddActionToCustomFilters < ActiveRecord::Migration[6.1]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||||
|
|
||||||
class RemoveWholeWordFromCustomFilters < ActiveRecord::Migration[6.1]
|
class RemoveWholeWordFromCustomFilters < ActiveRecord::Migration[6.1]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||||
|
|
||||||
class RemoveIrreversibleFromCustomFilters < ActiveRecord::Migration[6.1]
|
class RemoveIrreversibleFromCustomFilters < ActiveRecord::Migration[6.1]
|
||||||
|
@ -79,11 +79,13 @@ class BackfillAdminActionLogs < ActiveRecord::Migration[6.1]
|
|||||||
safety_assured do
|
safety_assured do
|
||||||
AdminActionLog.includes(:account).where(target_type: 'Account', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(:account).where(target_type: 'Account', human_identifier: nil).find_each do |log|
|
||||||
next if log.account.nil?
|
next if log.account.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.account.acct)
|
log.update_attribute('human_identifier', log.account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(user: :account).where(target_type: 'User', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(user: :account).where(target_type: 'User', human_identifier: nil).find_each do |log|
|
||||||
next if log.user.nil?
|
next if log.user.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.user.account.acct)
|
log.update_attribute('human_identifier', log.user.account.acct)
|
||||||
log.update_attribute('route_param', log.user.account_id)
|
log.update_attribute('route_param', log.user.account_id)
|
||||||
end
|
end
|
||||||
@ -92,57 +94,68 @@ class BackfillAdminActionLogs < ActiveRecord::Migration[6.1]
|
|||||||
|
|
||||||
AdminActionLog.includes(:domain_block).where(target_type: 'DomainBlock').find_each do |log|
|
AdminActionLog.includes(:domain_block).where(target_type: 'DomainBlock').find_each do |log|
|
||||||
next if log.domain_block.nil?
|
next if log.domain_block.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.domain_block.domain)
|
log.update_attribute('human_identifier', log.domain_block.domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:domain_allow).where(target_type: 'DomainAllow').find_each do |log|
|
AdminActionLog.includes(:domain_allow).where(target_type: 'DomainAllow').find_each do |log|
|
||||||
next if log.domain_allow.nil?
|
next if log.domain_allow.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.domain_allow.domain)
|
log.update_attribute('human_identifier', log.domain_allow.domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:email_domain_block).where(target_type: 'EmailDomainBlock').find_each do |log|
|
AdminActionLog.includes(:email_domain_block).where(target_type: 'EmailDomainBlock').find_each do |log|
|
||||||
next if log.email_domain_block.nil?
|
next if log.email_domain_block.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.email_domain_block.domain)
|
log.update_attribute('human_identifier', log.email_domain_block.domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:unavailable_domain).where(target_type: 'UnavailableDomain').find_each do |log|
|
AdminActionLog.includes(:unavailable_domain).where(target_type: 'UnavailableDomain').find_each do |log|
|
||||||
next if log.unavailable_domain.nil?
|
next if log.unavailable_domain.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.unavailable_domain.domain)
|
log.update_attribute('human_identifier', log.unavailable_domain.domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(status: :account).where(target_type: 'Status', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(status: :account).where(target_type: 'Status', human_identifier: nil).find_each do |log|
|
||||||
next if log.status.nil?
|
next if log.status.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.status.account.acct)
|
log.update_attribute('human_identifier', log.status.account.acct)
|
||||||
log.update_attribute('permalink', log.status.uri)
|
log.update_attribute('permalink', log.status.uri)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(account_warning: :account).where(target_type: 'AccountWarning', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(account_warning: :account).where(target_type: 'AccountWarning', human_identifier: nil).find_each do |log|
|
||||||
next if log.account_warning.nil?
|
next if log.account_warning.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.account_warning.account.acct)
|
log.update_attribute('human_identifier', log.account_warning.account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:announcement).where(target_type: 'Announcement', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(:announcement).where(target_type: 'Announcement', human_identifier: nil).find_each do |log|
|
||||||
next if log.announcement.nil?
|
next if log.announcement.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.announcement.text)
|
log.update_attribute('human_identifier', log.announcement.text)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:ip_block).where(target_type: 'IpBlock', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(:ip_block).where(target_type: 'IpBlock', human_identifier: nil).find_each do |log|
|
||||||
next if log.ip_block.nil?
|
next if log.ip_block.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', "#{log.ip_block.ip}/#{log.ip_block.ip.prefix}")
|
log.update_attribute('human_identifier', "#{log.ip_block.ip}/#{log.ip_block.ip.prefix}")
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:custom_emoji).where(target_type: 'CustomEmoji', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(:custom_emoji).where(target_type: 'CustomEmoji', human_identifier: nil).find_each do |log|
|
||||||
next if log.custom_emoji.nil?
|
next if log.custom_emoji.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.custom_emoji.shortcode)
|
log.update_attribute('human_identifier', log.custom_emoji.shortcode)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(:canonical_email_block).where(target_type: 'CanonicalEmailBlock', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(:canonical_email_block).where(target_type: 'CanonicalEmailBlock', human_identifier: nil).find_each do |log|
|
||||||
next if log.canonical_email_block.nil?
|
next if log.canonical_email_block.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.canonical_email_block.canonical_email_hash)
|
log.update_attribute('human_identifier', log.canonical_email_block.canonical_email_hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
AdminActionLog.includes(appeal: :account).where(target_type: 'Appeal', human_identifier: nil).find_each do |log|
|
AdminActionLog.includes(appeal: :account).where(target_type: 'Appeal', human_identifier: nil).find_each do |log|
|
||||||
next if log.appeal.nil?
|
next if log.appeal.nil?
|
||||||
|
|
||||||
log.update_attribute('human_identifier', log.appeal.account.acct)
|
log.update_attribute('human_identifier', log.appeal.account.acct)
|
||||||
log.update_attribute('route_param', log.appeal.account_warning_id)
|
log.update_attribute('route_param', log.appeal.account_warning_id)
|
||||||
end
|
end
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user