mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: Bump rubocop-discourse to 3.8.5
This version bump enables the `Style/MutableConstant` cop
This commit is contained in:
parent
79254c59f9
commit
664917def3
|
@ -469,7 +469,7 @@ GEM
|
|||
parser (>= 3.3.1.0)
|
||||
rubocop-capybara (2.21.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-discourse (3.8.4)
|
||||
rubocop-discourse (3.8.5)
|
||||
activesupport (>= 6.1)
|
||||
rubocop (>= 1.59.0)
|
||||
rubocop-capybara (>= 2.0.0)
|
||||
|
|
|
@ -5,7 +5,7 @@ class Admin::Config::SiteSettingsController < Admin::AdminController
|
|||
extended_site_description
|
||||
about_banner_image
|
||||
community_owner
|
||||
]
|
||||
].freeze
|
||||
|
||||
# This endpoint is intended to be used only for admin config areas,
|
||||
# for a specific collection of site settings. The admin site settings
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
class Admin::ReportsController < Admin::StaffController
|
||||
REPORTS_LIMIT = 50
|
||||
|
||||
HIDDEN_PAGEVIEW_REPORTS = %w[site_traffic page_view_legacy_total_reqs]
|
||||
HIDDEN_PAGEVIEW_REPORTS = %w[site_traffic page_view_legacy_total_reqs].freeze
|
||||
|
||||
HIDDEN_LEGACY_PAGEVIEW_REPORTS = %w[
|
||||
consolidated_page_views_browser_detection
|
||||
page_view_anon_reqs
|
||||
page_view_logged_in_reqs
|
||||
]
|
||||
].freeze
|
||||
|
||||
def index
|
||||
page_view_req_report_methods =
|
||||
|
|
|
@ -45,7 +45,7 @@ class Admin::ThemesController < Admin::AdminController
|
|||
application/x-gzip
|
||||
application/x-zip-compressed
|
||||
application/zip
|
||||
]
|
||||
].freeze
|
||||
|
||||
def import
|
||||
@theme = nil
|
||||
|
|
|
@ -12,7 +12,7 @@ class ExtraLocalesController < ApplicationController
|
|||
OVERRIDES_BUNDLE = "overrides"
|
||||
MD5_HASH_LENGTH = 32
|
||||
MF_BUNDLE = "mf"
|
||||
BUNDLES = [OVERRIDES_BUNDLE, MF_BUNDLE]
|
||||
BUNDLES = [OVERRIDES_BUNDLE, MF_BUNDLE].freeze
|
||||
|
||||
class << self
|
||||
def js_digests
|
||||
|
|
|
@ -33,7 +33,7 @@ class GroupsController < ApplicationController
|
|||
close: Proc.new { |groups| groups.where(public_admission: false, automatic: false) },
|
||||
automatic: Proc.new { |groups| groups.where(automatic: true) },
|
||||
non_automatic: Proc.new { |groups| groups.where(automatic: false) },
|
||||
}
|
||||
}.freeze
|
||||
ADD_MEMBERS_LIMIT = 1000
|
||||
|
||||
def index
|
||||
|
|
|
@ -19,9 +19,9 @@ class RobotsTxtController < ApplicationController
|
|||
/user-api-key
|
||||
/*?api_key*
|
||||
/*?*api_key*
|
||||
]
|
||||
].freeze
|
||||
|
||||
DISALLOWED_WITH_HEADER_PATHS = %w[/badges /u/ /my /search /tag/*/l /g /t/*/*.rss /c/*.rss]
|
||||
DISALLOWED_WITH_HEADER_PATHS = %w[/badges /u/ /my /search /tag/*/l /g /t/*/*.rss /c/*.rss].freeze
|
||||
|
||||
def index
|
||||
if (overridden = SiteSetting.overridden_robots_txt.dup).present?
|
||||
|
|
|
@ -9,8 +9,8 @@ class StaticController < ApplicationController
|
|||
|
||||
before_action :apply_cdn_headers, only: %i[cdn_asset enter favicon service_worker_asset]
|
||||
|
||||
PAGES_WITH_EMAIL_PARAM = %w[login password_reset signup]
|
||||
MODAL_PAGES = %w[password_reset signup]
|
||||
PAGES_WITH_EMAIL_PARAM = %w[login password_reset signup].freeze
|
||||
MODAL_PAGES = %w[password_reset signup].freeze
|
||||
DEFAULT_PAGES = {
|
||||
"faq" => {
|
||||
redirect: "faq_url",
|
||||
|
@ -24,8 +24,13 @@ class StaticController < ApplicationController
|
|||
redirect: "privacy_policy_url",
|
||||
topic_id: "privacy_topic_id",
|
||||
},
|
||||
}
|
||||
CUSTOM_PAGES = {} # Add via `#add_topic_static_page` in plugin API
|
||||
}.freeze
|
||||
|
||||
@@custom_pages = {} # Add via `#add_topic_static_page` in plugin API
|
||||
|
||||
def self.custom_pages
|
||||
@@custom_pages
|
||||
end
|
||||
|
||||
def show
|
||||
if current_user && (params[:id] == "login" || params[:id] == "signup")
|
||||
|
@ -44,7 +49,7 @@ class StaticController < ApplicationController
|
|||
return redirect_to(path("/guidelines")) if redirect_paths.include?(request.path)
|
||||
end
|
||||
|
||||
map = DEFAULT_PAGES.deep_merge(CUSTOM_PAGES)
|
||||
map = DEFAULT_PAGES.deep_merge(@@custom_pages)
|
||||
@page = params[:id]
|
||||
|
||||
if map.has_key?(@page)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class ThemeJavascriptsController < ApplicationController
|
||||
DISK_CACHE_PATH = "#{Rails.root}/tmp/javascript-cache"
|
||||
TESTS_DISK_CACHE_PATH = "#{Rails.root}/tmp/javascript-cache/tests"
|
||||
DISK_CACHE_PATH = "#{Rails.root}/tmp/javascript-cache".freeze
|
||||
TESTS_DISK_CACHE_PATH = "#{Rails.root}/tmp/javascript-cache/tests".freeze
|
||||
|
||||
skip_before_action(
|
||||
:check_xhr,
|
||||
|
|
|
@ -1300,7 +1300,7 @@ class UsersController < ApplicationController
|
|||
render json: to_render
|
||||
end
|
||||
|
||||
AVATAR_TYPES_WITH_UPLOAD = %w[uploaded custom gravatar]
|
||||
AVATAR_TYPES_WITH_UPLOAD = %w[uploaded custom gravatar].freeze
|
||||
|
||||
def pick_avatar
|
||||
user = fetch_user_from_params
|
||||
|
|
|
@ -23,7 +23,7 @@ module Jobs
|
|||
post_actions
|
||||
queued_posts
|
||||
visits
|
||||
]
|
||||
].freeze
|
||||
|
||||
HEADER_ATTRS_FOR =
|
||||
HashWithIndifferentAccess.new(
|
||||
|
|
|
@ -4,7 +4,15 @@ module Jobs
|
|||
class NotifyMailingListSubscribers < ::Jobs::Base
|
||||
include Skippable
|
||||
|
||||
RETRY_TIMES = [5.minute, 15.minute, 30.minute, 45.minute, 90.minute, 180.minute, 300.minute]
|
||||
RETRY_TIMES = [
|
||||
5.minute,
|
||||
15.minute,
|
||||
30.minute,
|
||||
45.minute,
|
||||
90.minute,
|
||||
180.minute,
|
||||
300.minute,
|
||||
].freeze
|
||||
|
||||
sidekiq_options queue: "low"
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class RejectionMailer < ActionMailer::Base
|
|||
allow_reply_by_email
|
||||
private_reply
|
||||
from_alias
|
||||
]
|
||||
].freeze
|
||||
|
||||
# Send an email rejection message.
|
||||
#
|
||||
|
|
|
@ -6,7 +6,7 @@ class AdminDashboardData
|
|||
cattr_reader :problem_messages, default: []
|
||||
|
||||
# kept for backward compatibility
|
||||
GLOBAL_REPORTS = []
|
||||
GLOBAL_REPORTS = [].freeze
|
||||
|
||||
PROBLEM_MESSAGE_PREFIX = "admin-problem:"
|
||||
SCHEDULED_PROBLEM_STORAGE_KEY = "admin-found-scheduled-problems-list"
|
||||
|
|
|
@ -4,7 +4,7 @@ class Bookmark < ActiveRecord::Base
|
|||
DEFAULT_BOOKMARKABLES = [
|
||||
RegisteredBookmarkable.new(PostBookmarkable),
|
||||
RegisteredBookmarkable.new(TopicBookmarkable),
|
||||
]
|
||||
].freeze
|
||||
|
||||
def self.registered_bookmarkables
|
||||
Set.new(DEFAULT_BOOKMARKABLES | DiscoursePluginRegistry.bookmarkables)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Category < ActiveRecord::Base
|
||||
RESERVED_SLUGS = ["none"]
|
||||
RESERVED_SLUGS = ["none"].freeze
|
||||
|
||||
self.ignored_columns = [
|
||||
:suppress_from_latest, # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||
|
@ -181,8 +181,8 @@ class Category < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
TOPIC_CREATION_PERMISSIONS = [:full]
|
||||
POST_CREATION_PERMISSIONS = %i[create_post full]
|
||||
TOPIC_CREATION_PERMISSIONS = [:full].freeze
|
||||
POST_CREATION_PERMISSIONS = %i[create_post full].freeze
|
||||
|
||||
scope :topic_create_allowed,
|
||||
->(guardian) do
|
||||
|
|
|
@ -275,7 +275,7 @@ class ColorScheme < ActiveRecord::Base
|
|||
"love_low" => "4B3F50",
|
||||
"love" => "fa6c8d",
|
||||
},
|
||||
}
|
||||
}.freeze
|
||||
|
||||
LIGHT_THEME_ID = "Light"
|
||||
|
||||
|
@ -314,9 +314,9 @@ class ColorScheme < ActiveRecord::Base
|
|||
|
||||
validates_associated :color_scheme_colors
|
||||
|
||||
BASE_COLORS_FILE = "#{Rails.root}/app/assets/stylesheets/common/foundation/colors.scss"
|
||||
BASE_COLORS_FILE = "#{Rails.root}/app/assets/stylesheets/common/foundation/colors.scss".freeze
|
||||
COLOR_TRANSFORMATION_FILE =
|
||||
"#{Rails.root}/app/assets/stylesheets/common/foundation/color_transformations.scss"
|
||||
"#{Rails.root}/app/assets/stylesheets/common/foundation/color_transformations.scss".freeze
|
||||
|
||||
@mutex = Mutex.new
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class DiscourseConnect < DiscourseConnectBase
|
|||
"USED_SSO_NONCE_#{nonce}"
|
||||
end
|
||||
|
||||
BANNED_EXTERNAL_IDS = %w[none nil blank null]
|
||||
BANNED_EXTERNAL_IDS = %w[none nil blank null].freeze
|
||||
|
||||
def lookup_or_create_user(ip_address = nil)
|
||||
# we don't want to ban 0 from being an external id
|
||||
|
|
|
@ -4,7 +4,7 @@ class Emoji
|
|||
# update this to clear the cache
|
||||
EMOJI_VERSION = "12"
|
||||
|
||||
FITZPATRICK_SCALE = %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff]
|
||||
FITZPATRICK_SCALE = %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff].freeze
|
||||
|
||||
DEFAULT_GROUP = "default"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ class Flag < ActiveRecord::Base
|
|||
# TODO(2025-01-15): krisk remove
|
||||
self.ignored_columns = ["custom_type"]
|
||||
|
||||
DEFAULT_VALID_APPLIES_TO = %w[Post Topic]
|
||||
DEFAULT_VALID_APPLIES_TO = %w[Post Topic].freeze
|
||||
MAX_SYSTEM_FLAG_ID = 1000
|
||||
MAX_NAME_LENGTH = 200
|
||||
MAX_DESCRIPTION_LENGTH = 1000
|
||||
|
|
|
@ -99,10 +99,10 @@ class Group < ActiveRecord::Base
|
|||
trust_level_2: 12,
|
||||
trust_level_3: 13,
|
||||
trust_level_4: 14,
|
||||
}
|
||||
}.freeze
|
||||
|
||||
AUTO_GROUP_IDS = Hash[*AUTO_GROUPS.to_a.flatten.reverse]
|
||||
STAFF_GROUPS = %i[admins moderators staff]
|
||||
STAFF_GROUPS = %i[admins moderators staff].freeze
|
||||
|
||||
AUTO_GROUPS_ADD = "add"
|
||||
AUTO_GROUPS_REMOVE = "remove"
|
||||
|
@ -114,7 +114,7 @@ class Group < ActiveRecord::Base
|
|||
imap_mailbox_name
|
||||
email_username
|
||||
email_password
|
||||
]
|
||||
].freeze
|
||||
|
||||
SMTP_SETTING_ATTRIBUTES = %w[
|
||||
imap_server
|
||||
|
@ -123,7 +123,7 @@ class Group < ActiveRecord::Base
|
|||
email_username
|
||||
email_password
|
||||
email_from_alias
|
||||
]
|
||||
].freeze
|
||||
|
||||
ALIAS_LEVELS = {
|
||||
nobody: 0,
|
||||
|
@ -132,7 +132,7 @@ class Group < ActiveRecord::Base
|
|||
members_mods_and_admins: 3,
|
||||
owners_mods_and_admins: 4,
|
||||
everyone: 99,
|
||||
}
|
||||
}.freeze
|
||||
|
||||
VALID_DOMAIN_REGEX = /\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}(:[0-9]{1,5})?(\/.*)?\Z/i
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class LocaleSiteSetting < EnumSiteSetting
|
|||
@lock.synchronize { @values = @language_names = @supported_locales = nil }
|
||||
end
|
||||
|
||||
FALLBACKS = { en_GB: :en }
|
||||
FALLBACKS = { en_GB: :en }.freeze
|
||||
|
||||
def self.fallback_locale(locale)
|
||||
fallback_locale = FALLBACKS[locale.to_sym]
|
||||
|
|
|
@ -8,7 +8,7 @@ class RemoteTheme < ActiveRecord::Base
|
|||
theme_version
|
||||
minimum_discourse_version
|
||||
maximum_discourse_version
|
||||
]
|
||||
].freeze
|
||||
|
||||
class ImportError < StandardError
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ class RemoteTheme < ActiveRecord::Base
|
|||
after_header
|
||||
body_tag
|
||||
footer
|
||||
]
|
||||
].freeze
|
||||
|
||||
GITHUB_REGEXP = %r{\Ahttps?://github\.com/}
|
||||
GITHUB_SSH_REGEXP = %r{\Assh://git@github\.com:}
|
||||
|
@ -32,7 +32,7 @@ class RemoteTheme < ActiveRecord::Base
|
|||
MAX_THEME_FILE_COUNT = 1024
|
||||
MAX_THEME_SIZE = 256.megabytes
|
||||
MAX_THEME_SCREENSHOT_FILE_SIZE = 1.megabyte
|
||||
MAX_THEME_SCREENSHOT_DIMENSIONS = [3840, 2160] # 4K resolution
|
||||
MAX_THEME_SCREENSHOT_DIMENSIONS = [3840, 2160].freeze # 4K resolution
|
||||
THEME_SCREENSHOT_ALLOWED_FILE_TYPES = %w[.jpg .jpeg .gif .png].freeze
|
||||
|
||||
has_one :theme, autosave: false
|
||||
|
|
|
@ -14,7 +14,7 @@ class Report
|
|||
trust_level
|
||||
file_extension
|
||||
include_subcategories
|
||||
]
|
||||
].freeze
|
||||
|
||||
include Reports::Bookmarks
|
||||
include Reports::ConsolidatedApiRequests
|
||||
|
|
|
@ -5,7 +5,7 @@ class Reviewable < ActiveRecord::Base
|
|||
ReviewableFlaggedPost: BasicReviewableFlaggedPostSerializer,
|
||||
ReviewableQueuedPost: BasicReviewableQueuedPostSerializer,
|
||||
ReviewableUser: BasicReviewableUserSerializer,
|
||||
}
|
||||
}.freeze
|
||||
|
||||
self.ignored_columns = [:reviewable_by_group_id]
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class ScreenedIpAddress < ActiveRecord::Base
|
|||
[6, 60, 56],
|
||||
[6, 56, 52],
|
||||
[6, 52, 48],
|
||||
]
|
||||
].freeze
|
||||
|
||||
def self.watch(ip_address, opts = {})
|
||||
match_for_ip_address(ip_address) ||
|
||||
|
|
|
@ -10,7 +10,7 @@ class SidebarSectionLink < ActiveRecord::Base
|
|||
validates :linkable_type, presence: true
|
||||
validate :ensure_supported_linkable_type, if: :will_save_change_to_linkable_type?
|
||||
|
||||
SUPPORTED_LINKABLE_TYPES = %w[Category Tag SidebarUrl]
|
||||
SUPPORTED_LINKABLE_TYPES = %w[Category Tag SidebarUrl].freeze
|
||||
|
||||
before_validation :inherit_user_id
|
||||
before_create do
|
||||
|
|
|
@ -47,7 +47,7 @@ class SidebarUrl < ActiveRecord::Base
|
|||
icon: "certificate",
|
||||
segment: SidebarUrl.segments["secondary"],
|
||||
},
|
||||
]
|
||||
].freeze
|
||||
|
||||
validates :icon, presence: true, length: { maximum: MAX_ICON_LENGTH }
|
||||
validates :name, presence: true, length: { maximum: MAX_NAME_LENGTH }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SiteSetting < ActiveRecord::Base
|
||||
VALID_AREAS = %w[flags about]
|
||||
VALID_AREAS = %w[flags about].freeze
|
||||
|
||||
extend GlobalPath
|
||||
extend SiteSettingExtension
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SlugSetting < EnumSiteSetting
|
||||
VALUES = %w[ascii encoded none]
|
||||
VALUES = %w[ascii encoded none].freeze
|
||||
|
||||
def self.valid_value?(val)
|
||||
VALUES.include?(val)
|
||||
|
|
|
@ -12,7 +12,7 @@ class Tag < ActiveRecord::Base
|
|||
RESERVED_TAGS = [
|
||||
"none",
|
||||
"constructor", # prevents issues with javascript's constructor of objects
|
||||
]
|
||||
].freeze
|
||||
|
||||
validates :name, presence: true, uniqueness: { case_sensitive: false }
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ class ThemeField < ActiveRecord::Base
|
|||
end
|
||||
|
||||
class ThemeFileMatcher
|
||||
OPTIONS = %i[name type target]
|
||||
OPTIONS = %i[name type target].freeze
|
||||
# regex: used to match file names to fields (import).
|
||||
# can contain named capture groups for name/type/target
|
||||
# canonical: a lambda which converts name/type/target
|
||||
|
@ -653,7 +653,7 @@ class ThemeField < ActiveRecord::Base
|
|||
targets: :migrations,
|
||||
canonical: ->(h) { "migrations/settings/#{h[:name]}.js" },
|
||||
),
|
||||
]
|
||||
].freeze
|
||||
|
||||
# For now just work for standard fields
|
||||
def file_path
|
||||
|
@ -744,7 +744,7 @@ class ThemeField < ActiveRecord::Base
|
|||
|
||||
private
|
||||
|
||||
JAVASCRIPT_TYPES = %w[text/javascript application/javascript application/ecmascript]
|
||||
JAVASCRIPT_TYPES = %w[text/javascript application/javascript application/ecmascript].freeze
|
||||
|
||||
def inline_javascript?(node)
|
||||
if node["src"].present?
|
||||
|
|
|
@ -1789,7 +1789,7 @@ class Topic < ActiveRecord::Base
|
|||
total.first["hours"].to_f.round(2)
|
||||
end
|
||||
|
||||
WITH_NO_RESPONSE_SQL = <<-SQL
|
||||
WITH_NO_RESPONSE_SQL = <<-SQL.freeze
|
||||
SELECT COUNT(*) as count, tt.created_at AS "date"
|
||||
FROM (
|
||||
SELECT t.id, t.created_at::date AS created_at, MIN(p.post_number) first_reply
|
||||
|
@ -1824,7 +1824,7 @@ class Topic < ActiveRecord::Base
|
|||
builder.query_hash
|
||||
end
|
||||
|
||||
WITH_NO_RESPONSE_TOTAL_SQL = <<-SQL
|
||||
WITH_NO_RESPONSE_TOTAL_SQL = <<-SQL.freeze
|
||||
SELECT COUNT(*) as count
|
||||
FROM (
|
||||
SELECT t.id, MIN(p.post_number) first_reply
|
||||
|
|
|
@ -41,7 +41,7 @@ class TranslationOverride < ActiveRecord::Base
|
|||
optional_tags
|
||||
],
|
||||
%w[system_messages.welcome_user] => %w[username name name_or_username],
|
||||
}
|
||||
}.freeze
|
||||
|
||||
include HasSanitizableFields
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class UserAction < ActiveRecord::Base
|
|||
].each_with_index.to_a.flatten
|
||||
]
|
||||
|
||||
USER_ACTED_TYPES = [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE]
|
||||
USER_ACTED_TYPES = [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE].freeze
|
||||
|
||||
def self.types
|
||||
@types ||=
|
||||
|
|
|
@ -30,7 +30,7 @@ class UserApiKeyScope < ActiveRecord::Base
|
|||
RouteMatcher.new(methods: :put, actions: "user_status#set"),
|
||||
RouteMatcher.new(methods: :delete, actions: "user_status#clear"),
|
||||
],
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def self.all_scopes
|
||||
scopes = SCOPES
|
||||
|
|
|
@ -11,7 +11,7 @@ class UserAuthToken < ActiveRecord::Base
|
|||
|
||||
MAX_SESSION_COUNT = 60
|
||||
|
||||
USER_ACTIONS = ["generate"]
|
||||
USER_ACTIONS = ["generate"].freeze
|
||||
|
||||
attr_accessor :unhashed_auth_token
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class UserBadge < ActiveRecord::Base
|
|||
belongs_to :notification, dependent: :destroy
|
||||
belongs_to :post
|
||||
|
||||
BOOLEAN_ATTRIBUTES = %w[is_favorite]
|
||||
BOOLEAN_ATTRIBUTES = %w[is_favorite].freeze
|
||||
|
||||
scope :grouped_with_count,
|
||||
-> do
|
||||
|
|
|
@ -11,7 +11,7 @@ class UserOption < ActiveRecord::Base
|
|||
6 => "bookmarks",
|
||||
7 => "unseen",
|
||||
8 => "hot",
|
||||
}
|
||||
}.freeze
|
||||
|
||||
self.ignored_columns = [
|
||||
"sidebar_list_destination", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class UserPassword < ActiveRecord::Base
|
||||
MAX_PASSWORD_LENGTH = 200
|
||||
TARGET_PASSWORD_ALGORITHM =
|
||||
"$pbkdf2-#{Rails.configuration.pbkdf2_algorithm}$i=#{Rails.configuration.pbkdf2_iterations},l=32$"
|
||||
"$pbkdf2-#{Rails.configuration.pbkdf2_algorithm}$i=#{Rails.configuration.pbkdf2_iterations},l=32$".freeze
|
||||
PASSWORD_SALT_LENGTH = 16
|
||||
|
||||
belongs_to :user, required: true
|
||||
|
|
|
@ -79,7 +79,7 @@ class UserSummary
|
|||
user_counts(liked_users)
|
||||
end
|
||||
|
||||
REPLY_ACTIONS = [UserAction::RESPONSE, UserAction::QUOTE, UserAction::MENTION]
|
||||
REPLY_ACTIONS = [UserAction::RESPONSE, UserAction::QUOTE, UserAction::MENTION].freeze
|
||||
|
||||
def most_replied_to_users
|
||||
replied_users = {}
|
||||
|
@ -130,7 +130,7 @@ class UserSummary
|
|||
|
||||
class CategoryWithCounts < OpenStruct
|
||||
include ActiveModel::SerializerSupport
|
||||
KEYS = %i[id name color text_color slug read_restricted parent_category_id]
|
||||
KEYS = %i[id name color text_color slug read_restricted parent_category_id].freeze
|
||||
end
|
||||
|
||||
def top_categories
|
||||
|
|
|
@ -52,7 +52,7 @@ class WebHook < ActiveRecord::Base
|
|||
/\Atopic_\w+_status_updated\z/ => "topic_edited",
|
||||
"reviewable_score_updated" => "reviewable_updated",
|
||||
"reviewable_transitioned_to" => "reviewable_updated",
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def self.translate_event_name_to_type(event_name)
|
||||
EVENT_NAME_TO_EVENT_TYPE_MAP.each do |key, value|
|
||||
|
|
|
@ -86,7 +86,7 @@ class WebHookEventType < ActiveRecord::Base
|
|||
chat_message_edited: 1802,
|
||||
chat_message_trashed: 1803,
|
||||
chat_message_restored: 1804,
|
||||
}
|
||||
}.freeze
|
||||
|
||||
has_and_belongs_to_many :web_hooks
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class EmbeddableHostSerializer < ApplicationSerializer
|
||||
TO_SERIALIZE = %i[id host allowed_paths class_name category_id tags user]
|
||||
TO_SERIALIZE = %i[id host allowed_paths class_name category_id tags user].freeze
|
||||
|
||||
attributes *TO_SERIALIZE
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class PostSerializer < BasicPostSerializer
|
|||
post_actions
|
||||
all_post_actions
|
||||
add_excerpt
|
||||
]
|
||||
].freeze
|
||||
|
||||
INSTANCE_VARS.each { |v| self.public_send(:attr_accessor, v) }
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class ReviewableScoreSerializer < ApplicationSerializer
|
|||
email_spam: "email_in_spam_header",
|
||||
suspect_user: "approve_suspect_users",
|
||||
contains_media: "skip_media_review_groups",
|
||||
}
|
||||
}.freeze
|
||||
|
||||
attributes :id, :score, :agree_stats, :reason, :created_at, :reviewed_at
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class EmailSettingsExceptionHandler
|
|||
Net::ReadTimeout,
|
||||
SocketError,
|
||||
Errno::ECONNREFUSED,
|
||||
]
|
||||
].freeze
|
||||
|
||||
class GenericProvider
|
||||
def initialize(exception)
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
class HashtagAutocompleteService
|
||||
HASHTAGS_PER_REQUEST = 20
|
||||
SEARCH_MAX_LIMIT = 50
|
||||
DEFAULT_DATA_SOURCES = [CategoryHashtagDataSource, TagHashtagDataSource]
|
||||
DEFAULT_DATA_SOURCES = [CategoryHashtagDataSource, TagHashtagDataSource].freeze
|
||||
DEFAULT_CONTEXTUAL_TYPE_PRIORITIES = [
|
||||
{ type: "category", context: "topic-composer", priority: 100 },
|
||||
{ type: "tag", context: "topic-composer", priority: 50 },
|
||||
]
|
||||
].freeze
|
||||
|
||||
def self.search_conditions
|
||||
@search_conditions ||= Enum.new(contains: 0, starts_with: 1)
|
||||
|
|
|
@ -522,7 +522,7 @@ class PostAlerter
|
|||
Notification.types[:posted],
|
||||
Notification.types[:private_message],
|
||||
Notification.types[:watching_category_or_tag],
|
||||
]
|
||||
].freeze
|
||||
|
||||
def create_notification(user, type, post, opts = {})
|
||||
opts = @default_opts.merge(opts)
|
||||
|
|
|
@ -405,8 +405,8 @@ class SearchIndexer
|
|||
html_scrubber.scrubbed.squish
|
||||
end
|
||||
|
||||
MENTION_CLASSES = %w[mention mention-group]
|
||||
ATTRIBUTES = %w[alt title href data-video-title]
|
||||
MENTION_CLASSES = %w[mention mention-group].freeze
|
||||
ATTRIBUTES = %w[alt title href data-video-title].freeze
|
||||
|
||||
def start_element(_name, attributes = [])
|
||||
attributes = Hash[*attributes.flatten]
|
||||
|
|
|
@ -11,7 +11,7 @@ class StaffActionLogger
|
|||
raise Discourse::InvalidParameters.new(:admin) unless @admin && @admin.is_a?(User)
|
||||
end
|
||||
|
||||
USER_FIELDS = %i[id username name created_at trust_level last_seen_at last_emailed_at]
|
||||
USER_FIELDS = %i[id username name created_at trust_level last_seen_at last_emailed_at].freeze
|
||||
|
||||
def log_user_deletion(deleted_user, opts = {})
|
||||
unless deleted_user && deleted_user.is_a?(User)
|
||||
|
@ -428,7 +428,7 @@ class StaffActionLogger
|
|||
auto_revoke
|
||||
show_posts
|
||||
system
|
||||
]
|
||||
].freeze
|
||||
|
||||
def log_badge_creation(badge)
|
||||
raise Discourse::InvalidParameters.new(:badge) unless badge
|
||||
|
|
|
@ -7,15 +7,16 @@ class UserUpdater
|
|||
tracked_category_ids: :tracking,
|
||||
regular_category_ids: :regular,
|
||||
muted_category_ids: :muted,
|
||||
}
|
||||
}.freeze
|
||||
|
||||
TAG_NAMES = {
|
||||
watching_first_post_tags: :watching_first_post,
|
||||
watched_tags: :watching,
|
||||
tracked_tags: :tracking,
|
||||
muted_tags: :muted,
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# rubocop:disable Style/MutableConstant
|
||||
OPTION_ATTR = %i[
|
||||
mailing_list_mode
|
||||
mailing_list_mode_frequency
|
||||
|
@ -55,6 +56,7 @@ class UserUpdater
|
|||
watched_precedence_over_muted
|
||||
topics_unread_when_closed
|
||||
]
|
||||
# rubocop:enable Style/MutableConstant
|
||||
|
||||
NOTIFICATION_SCHEDULE_ATTRS = -> do
|
||||
attrs = [:enabled]
|
||||
|
|
|
@ -6,7 +6,7 @@ require "pathname"
|
|||
RAILS_ROOT = File.expand_path("../../", Pathname.new(__FILE__).realpath)
|
||||
PORT = ENV["UNICORN_PORT"] ||= "3000"
|
||||
HOSTNAME = ENV["DISCOURSE_HOSTNAME"] ||= "127.0.0.1"
|
||||
CUSTOM_ARGS = %w[--try --test --build --unicorn -u --forward-host]
|
||||
CUSTOM_ARGS = %w[--try --test --build --unicorn -u --forward-host].freeze
|
||||
PROXY =
|
||||
if ARGV.include?("--try")
|
||||
"https://try.discourse.org"
|
||||
|
|
|
@ -77,7 +77,7 @@ if ENV["TRACE_PG_CONNECTIONS"]
|
|||
async_prepare
|
||||
sync_exec_prepared
|
||||
async_exec_prepared
|
||||
]
|
||||
].freeze
|
||||
|
||||
LOG_ACCESS_METHODS.each do |method|
|
||||
new_method = "#{method}_without_logging".to_sym
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
RUN_WITHOUT_PREPARE = [
|
||||
"#{Rails.root}/lib/freedom_patches/rails_multisite.rb",
|
||||
"#{Rails.root}/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb",
|
||||
]
|
||||
].freeze
|
||||
RUN_WITHOUT_PREPARE.each { |path| require(path) }
|
||||
|
||||
Rails.application.reloader.to_prepare do
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateTopTopics < ActiveRecord::Migration[4.2]
|
||||
PERIODS = %i[yearly monthly weekly daily]
|
||||
SORT_ORDERS = %i[posts views likes]
|
||||
PERIODS = %i[yearly monthly weekly daily].freeze
|
||||
SORT_ORDERS = %i[posts views likes].freeze
|
||||
|
||||
def change
|
||||
create_table :top_topics, force: true do |t|
|
||||
|
|
|
@ -52,7 +52,7 @@ class RemoveSuperfluousColumns < ActiveRecord::Migration[5.2]
|
|||
themes: %i[key],
|
||||
email_logs: %i[topic_id reply_key skipped skipped_reason],
|
||||
posts: %i[vote_count],
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
BadgePostsViewManager.drop!
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/table_dropper"
|
||||
|
||||
class RemoveSuperfluousTables < ActiveRecord::Migration[5.2]
|
||||
DROPPED_TABLES = %i[category_featured_users versions topic_status_updates]
|
||||
DROPPED_TABLES = %i[category_featured_users versions topic_status_updates].freeze
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class DropGroupLockedTrustLevelFromUser < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS = { posts: %i[group_locked_trust_level] }
|
||||
DROPPED_COLUMNS = { posts: %i[group_locked_trust_level] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class RemoveUploadedMetaIdFromCategory < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS = { categories: %i[uploaded_meta_id] }
|
||||
DROPPED_COLUMNS = { categories: %i[uploaded_meta_id] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/table_dropper"
|
||||
|
||||
class DropUnusedAuthTablesAgain < ActiveRecord::Migration[5.2]
|
||||
DROPPED_TABLES = %i[facebook_user_infos twitter_user_infos]
|
||||
DROPPED_TABLES = %i[facebook_user_infos twitter_user_infos].freeze
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class DropEmailUserOptionsColumns < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS = { user_options: %i[email_direct email_private_messages email_always] }
|
||||
DROPPED_COLUMNS = { user_options: %i[email_direct email_private_messages email_always] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class RemoveViaEmailFromInvite < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS = { invites: %i[via_email] }
|
||||
DROPPED_COLUMNS = { invites: %i[via_email] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoveSuppressFromLatestFromCategory < ActiveRecord::Migration[6.0]
|
||||
DROPPED_COLUMNS = { categories: %i[suppress_from_latest] }
|
||||
DROPPED_COLUMNS = { categories: %i[suppress_from_latest] }.freeze
|
||||
|
||||
def up
|
||||
ids = DB.query_single("SELECT id::text FROM categories WHERE suppress_from_latest = TRUE")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/table_dropper"
|
||||
|
||||
class DropUnusedGoogleInstagramAuthTables < ActiveRecord::Migration[6.0]
|
||||
DROPPED_TABLES = %i[google_user_infos instagram_user_infos]
|
||||
DROPPED_TABLES = %i[google_user_infos instagram_user_infos].freeze
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
class RemoveKeyFromApiKeys < ActiveRecord::Migration[6.0]
|
||||
DROPPED_COLUMNS = { api_keys: %i[key] }
|
||||
DROPPED_COLUMNS = { api_keys: %i[key] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -4,7 +4,7 @@ class DropUnusedColumns < ActiveRecord::Migration[6.0]
|
|||
DROPPED_COLUMNS = {
|
||||
post_replies: %i[reply_id],
|
||||
user_profiles: %i[card_background profile_background],
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoveKeyFromUserApiKey < ActiveRecord::Migration[6.0]
|
||||
DROPPED_COLUMNS = { user_api_keys: %i[key] }
|
||||
DROPPED_COLUMNS = { user_api_keys: %i[key] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropAutomaticMembershipRetroactiveFromGroup < ActiveRecord::Migration[6.0]
|
||||
DROPPED_COLUMNS = { groups: %i[automatic_membership_retroactive] }
|
||||
DROPPED_COLUMNS = { groups: %i[automatic_membership_retroactive] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropTopicReplyCount < ActiveRecord::Migration[6.0]
|
||||
DROPPED_COLUMNS = { user_stats: %i[topic_reply_count] }
|
||||
DROPPED_COLUMNS = { user_stats: %i[topic_reply_count] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -21,7 +21,7 @@ class AllowlistAndBlocklistSiteSettings < ActiveRecord::Migration[6.0]
|
|||
white_listed_spam_host_domains: "allowed_spam_host_domains",
|
||||
embed_blacklist_selector: "blocked_embed_selectors",
|
||||
embed_classname_whitelist: "allowed_embed_classnames",
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair { |old_key, new_key| DB.exec <<~SQL }
|
||||
|
|
|
@ -21,7 +21,7 @@ class RemoveDeprecatedAllowlistSettings < ActiveRecord::Migration[6.0]
|
|||
white_listed_spam_host_domains: "allowed_spam_host_domains",
|
||||
embed_blacklist_selector: "blocked_embed_selectors",
|
||||
embed_classname_whitelist: "allowed_embed_classnames",
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair { |old_key, _new_key| DB.exec <<~SQL }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropPathWhitelistFromEmbeddableHosts < ActiveRecord::Migration[6.0]
|
||||
DROPPED_COLUMNS = { embeddable_hosts: %i[path_whitelist] }
|
||||
DROPPED_COLUMNS = { embeddable_hosts: %i[path_whitelist] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/table_dropper"
|
||||
|
||||
class DropGithubUserInfos < ActiveRecord::Migration[6.0]
|
||||
DROPPED_TABLES = %i[github_user_infos]
|
||||
DROPPED_TABLES = %i[github_user_infos].freeze
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -21,7 +21,7 @@ class RenameSsoSiteSettings < ActiveRecord::Migration[6.0]
|
|||
%w[sso_overrides_card_background discourse_connect_overrides_card_background],
|
||||
%w[external_auth_skip_create_confirm auth_skip_create_confirm],
|
||||
%w[external_auth_immediately auth_immediately],
|
||||
]
|
||||
].freeze
|
||||
|
||||
def up
|
||||
# Copying the rows so that things keep working during deploy
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RenameTrustLevelTranslations < ActiveRecord::Migration[6.1]
|
||||
KEYS = %w[newuser basic member regular leader]
|
||||
KEYS = %w[newuser basic member regular leader].freeze
|
||||
|
||||
def up
|
||||
KEYS.each { |key| execute <<~SQL }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class RemoveHighestSeenPostNumberFromTopicUsers < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { topic_users: %i[highest_seen_post_number] }
|
||||
DROPPED_COLUMNS = { topic_users: %i[highest_seen_post_number] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropDurationColumnFromTopicTimers < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { topic_timers: %i[duration] }
|
||||
DROPPED_COLUMNS = { topic_timers: %i[duration] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropDisableJumpReplyColumnFromUserOptions < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { user_options: %i[disable_jump_reply] }
|
||||
DROPPED_COLUMNS = { user_options: %i[disable_jump_reply] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropUploadsVerified < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { uploads: %i[verified] }
|
||||
DROPPED_COLUMNS = { uploads: %i[verified] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropTokenFromEmailTokens < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { email_tokens: %i[token] }
|
||||
DROPPED_COLUMNS = { email_tokens: %i[token] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class DropOldBookmarkColumns < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { bookmarks: %i[topic_id reminder_type] }
|
||||
DROPPED_COLUMNS = { bookmarks: %i[topic_id reminder_type] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropCategoryRequiredTagGroupColumns < ActiveRecord::Migration[6.1]
|
||||
DROPPED_COLUMNS = { categories: %i[required_tag_group_id min_tags_from_required_group] }
|
||||
DROPPED_COLUMNS = { categories: %i[required_tag_group_id min_tags_from_required_group] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropFlairUrlFromGroups < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS = { groups: %i[flair_url] }
|
||||
DROPPED_COLUMNS = { groups: %i[flair_url] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class DropOldBookmarkColumnsV2 < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS = { bookmarks: %i[post_id for_topic] }
|
||||
DROPPED_COLUMNS = { bookmarks: %i[post_id for_topic] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -4,7 +4,7 @@ class RenameRateLimitSearchAnon < ActiveRecord::Migration[7.0]
|
|||
RENAME_SETTINGS = [
|
||||
%w[rate_limit_search_anon_user rate_limit_search_anon_user_per_minute],
|
||||
%w[rate_limit_search_anon_global rate_limit_search_anon_global_per_minute],
|
||||
]
|
||||
].freeze
|
||||
|
||||
def up
|
||||
# Copying the rows so that things keep working during deploy
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class RemoveTopicCountFromTags < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS = { tags: %i[topic_count] }
|
||||
DROPPED_COLUMNS = { tags: %i[topic_count] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropBadgeGrantedTitleColumn < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS = { user_profiles: %i[badge_granted_title] }
|
||||
DROPPED_COLUMNS = { user_profiles: %i[badge_granted_title] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -11,7 +11,7 @@ class InsertCommunityToSidebarSections < ActiveRecord::Migration[7.0]
|
|||
{ name: "FAQ", path: "/faq", icon: "question-circle", segment: 1 },
|
||||
{ name: "Groups", path: "/g", icon: "user-friends", segment: 1 },
|
||||
{ name: "Badges", path: "/badges", icon: "certificate", segment: 1 },
|
||||
]
|
||||
].freeze
|
||||
def up
|
||||
result = DB.query <<~SQL
|
||||
INSERT INTO sidebar_sections(user_id, title, public, section_type, created_at, updated_at)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropPostUploadsTable < ActiveRecord::Migration[7.0]
|
||||
DROPPED_TABLES = %i[post_uploads]
|
||||
DROPPED_TABLES = %i[post_uploads].freeze
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropBadgeImageColumn < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS = { badges: %i[image] }
|
||||
DROPPED_COLUMNS = { badges: %i[image] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -16,7 +16,7 @@ class DropDeprecatedColumns < ActiveRecord::Migration[7.0]
|
|||
user_options: %i[disable_jump_reply sidebar_list_destination],
|
||||
user_profiles: %i[badge_granted_title],
|
||||
user_stats: %i[topic_reply_count],
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropCompiledJsFromTranslationOverrides < ActiveRecord::Migration[7.1]
|
||||
DROPPED_COLUMNS = { translation_overrides: %i[compiled_js] }
|
||||
DROPPED_COLUMNS = { translation_overrides: %i[compiled_js] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropCustomTypeFromFlags < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS = { flags: %i[custom_type] }
|
||||
DROPPED_COLUMNS = { flags: %i[custom_type] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropGroupsSmtpSsl < ActiveRecord::Migration[7.1]
|
||||
DROPPED_COLUMNS = { groups: %i[smtp_ssl] }
|
||||
DROPPED_COLUMNS = { groups: %i[smtp_ssl] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -6,7 +6,7 @@ class DropOldNotificationIdColumns < ActiveRecord::Migration[7.1]
|
|||
shelved_notifications: %i[old_notification_id],
|
||||
users: %i[old_seen_notification_id],
|
||||
user_badges: %i[old_notification_id],
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
class DropPasswordColumnsFromUsers < ActiveRecord::Migration[7.1]
|
||||
DROPPED_COLUMNS = { users: %i[password_hash salt password_algorithm] }
|
||||
DROPPED_COLUMNS = { users: %i[password_hash salt password_algorithm] }.freeze
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -21,7 +21,7 @@ class AdminUserIndexQuery
|
|||
"topics_viewed" => "user_stats.topics_entered",
|
||||
"posts" => "user_stats.post_count",
|
||||
"read_time" => "user_stats.time_read",
|
||||
}
|
||||
}.freeze
|
||||
|
||||
def find_users(limit = 100)
|
||||
page = params[:page].to_i - 1
|
||||
|
|
|
@ -66,7 +66,7 @@ class Auth::DefaultCurrentUserProvider
|
|||
),
|
||||
RouteMatcher.new(methods: :get, actions: "users#bookmarks", formats: :ics),
|
||||
RouteMatcher.new(methods: :post, actions: "admin/email#handle_mail", formats: nil),
|
||||
]
|
||||
].freeze
|
||||
|
||||
def self.find_v0_auth_cookie(request)
|
||||
cookie = request.cookies[TOKEN_COOKIE]
|
||||
|
|
|
@ -25,7 +25,7 @@ class Auth::Result
|
|||
overrides_email
|
||||
overrides_username
|
||||
overrides_name
|
||||
]
|
||||
].freeze
|
||||
|
||||
attr_accessor *ATTRIBUTES
|
||||
|
||||
|
@ -43,7 +43,7 @@ class Auth::Result
|
|||
overrides_email
|
||||
overrides_username
|
||||
overrides_name
|
||||
]
|
||||
].freeze
|
||||
|
||||
def [](key)
|
||||
key = key.to_sym
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user