mirror of
https://github.com/discourse/discourse.git
synced 2025-10-04 17:32:34 +08:00
DEV: Remove logical OR assignment of constants (#29201)
Constants should always be only assigned once. The logical OR assignment of a constant is a relic of the past before we used zeitwerk for autoloading and had bugs where a file could be loaded twice resulting in constant redefinition warnings.
This commit is contained in:
parent
f3f37c9019
commit
322a3be2db
112 changed files with 267 additions and 267 deletions
|
@ -40,7 +40,7 @@ class Admin::ThemesController < Admin::AdminController
|
||||||
render json: { public_key: k.ssh_public_key }
|
render json: { public_key: k.ssh_public_key }
|
||||||
end
|
end
|
||||||
|
|
||||||
THEME_CONTENT_TYPES ||= %w[
|
THEME_CONTENT_TYPES = %w[
|
||||||
application/gzip
|
application/gzip
|
||||||
application/x-gzip
|
application/x-gzip
|
||||||
application/x-zip-compressed
|
application/x-zip-compressed
|
||||||
|
|
|
@ -56,8 +56,8 @@ class ApplicationController < ActionController::Base
|
||||||
after_action :clean_xml, if: :is_feed_response?
|
after_action :clean_xml, if: :is_feed_response?
|
||||||
after_action :add_early_hint_header, if: -> { spa_boot_request? }
|
after_action :add_early_hint_header, if: -> { spa_boot_request? }
|
||||||
|
|
||||||
HONEYPOT_KEY ||= "HONEYPOT_KEY"
|
HONEYPOT_KEY = "HONEYPOT_KEY"
|
||||||
CHALLENGE_KEY ||= "CHALLENGE_KEY"
|
CHALLENGE_KEY = "CHALLENGE_KEY"
|
||||||
|
|
||||||
layout :set_layout
|
layout :set_layout
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ class ExtraLocalesController < ApplicationController
|
||||||
:redirect_to_profile_if_required,
|
:redirect_to_profile_if_required,
|
||||||
:verify_authenticity_token
|
:verify_authenticity_token
|
||||||
|
|
||||||
OVERRIDES_BUNDLE ||= "overrides"
|
OVERRIDES_BUNDLE = "overrides"
|
||||||
MD5_HASH_LENGTH ||= 32
|
MD5_HASH_LENGTH = 32
|
||||||
MF_BUNDLE = "mf"
|
MF_BUNDLE = "mf"
|
||||||
BUNDLES = [OVERRIDES_BUNDLE, MF_BUNDLE]
|
BUNDLES = [OVERRIDES_BUNDLE, MF_BUNDLE]
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ class GroupsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MAX_NOTIFIED_OWNERS ||= 20
|
MAX_NOTIFIED_OWNERS = 20
|
||||||
|
|
||||||
def request_membership
|
def request_membership
|
||||||
params.require(:reason)
|
params.require(:reason)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class PostsController < ApplicationController
|
||||||
:check_xhr,
|
:check_xhr,
|
||||||
only: %i[markdown_id markdown_num short_link latest user_posts_feed]
|
only: %i[markdown_id markdown_num short_link latest user_posts_feed]
|
||||||
|
|
||||||
MARKDOWN_TOPIC_PAGE_SIZE ||= 100
|
MARKDOWN_TOPIC_PAGE_SIZE = 100
|
||||||
|
|
||||||
def markdown_id
|
def markdown_id
|
||||||
markdown Post.find_by(id: params[:id].to_i)
|
markdown Post.find_by(id: params[:id].to_i)
|
||||||
|
@ -429,7 +429,7 @@ class PostsController < ApplicationController
|
||||||
render_json_error(e.message)
|
render_json_error(e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
MAX_POST_REPLIES ||= 20
|
MAX_POST_REPLIES = 20
|
||||||
|
|
||||||
def replies
|
def replies
|
||||||
params.permit(:after)
|
params.permit(:after)
|
||||||
|
|
|
@ -5,7 +5,7 @@ class PresenceController < ApplicationController
|
||||||
before_action :ensure_logged_in, only: [:update]
|
before_action :ensure_logged_in, only: [:update]
|
||||||
before_action :skip_persist_session
|
before_action :skip_persist_session
|
||||||
|
|
||||||
MAX_CHANNELS_PER_REQUEST ||= 50
|
MAX_CHANNELS_PER_REQUEST = 50
|
||||||
|
|
||||||
def get
|
def get
|
||||||
names = params.require(:channels)
|
names = params.require(:channels)
|
||||||
|
|
|
@ -10,7 +10,7 @@ class RobotsTxtController < ApplicationController
|
||||||
OVERRIDDEN_HEADER = "# This robots.txt file has been customized at /admin/customize/robots\n"
|
OVERRIDDEN_HEADER = "# This robots.txt file has been customized at /admin/customize/robots\n"
|
||||||
|
|
||||||
# NOTE: order is important!
|
# NOTE: order is important!
|
||||||
DISALLOWED_PATHS ||= %w[
|
DISALLOWED_PATHS = %w[
|
||||||
/admin/
|
/admin/
|
||||||
/auth/
|
/auth/
|
||||||
/assets/browser-update*.js
|
/assets/browser-update*.js
|
||||||
|
@ -21,7 +21,7 @@ class RobotsTxtController < ApplicationController
|
||||||
/*?*api_key*
|
/*?*api_key*
|
||||||
]
|
]
|
||||||
|
|
||||||
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]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if (overridden = SiteSetting.overridden_robots_txt.dup).present?
|
if (overridden = SiteSetting.overridden_robots_txt.dup).present?
|
||||||
|
|
|
@ -145,7 +145,7 @@ class StaticController < ApplicationController
|
||||||
redirect_to(destination, allow_other_host: false)
|
redirect_to(destination, allow_other_host: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
FAVICON ||= -"favicon"
|
FAVICON = -"favicon"
|
||||||
|
|
||||||
# We need to be able to draw our favicon on a canvas, this happens when you enable the feature
|
# We need to be able to draw our favicon on a canvas, this happens when you enable the feature
|
||||||
# that draws the notification count on top of favicon (per user default off)
|
# that draws the notification count on top of favicon (per user default off)
|
||||||
|
|
|
@ -9,7 +9,7 @@ class UserApiKeysController < ApplicationController
|
||||||
only: %i[new otp]
|
only: %i[new otp]
|
||||||
skip_before_action :check_xhr, :preload_json
|
skip_before_action :check_xhr, :preload_json
|
||||||
|
|
||||||
AUTH_API_VERSION ||= 4
|
AUTH_API_VERSION = 4
|
||||||
|
|
||||||
def new
|
def new
|
||||||
if request.head?
|
if request.head?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Users::AssociateAccountsController < ApplicationController
|
class Users::AssociateAccountsController < ApplicationController
|
||||||
SECURE_SESSION_PREFIX ||= "omniauth_reconnect"
|
SECURE_SESSION_PREFIX = "omniauth_reconnect"
|
||||||
|
|
||||||
before_action :ensure_logged_in
|
before_action :ensure_logged_in
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Jobs
|
||||||
attr_accessor :current_user
|
attr_accessor :current_user
|
||||||
attr_accessor :entity
|
attr_accessor :entity
|
||||||
|
|
||||||
HEADER_ATTRS_FOR ||=
|
HEADER_ATTRS_FOR =
|
||||||
HashWithIndifferentAccess.new(
|
HashWithIndifferentAccess.new(
|
||||||
user_list: %w[
|
user_list: %w[
|
||||||
id
|
id
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Jobs
|
||||||
# note: contents provided entirely by user
|
# note: contents provided entirely by user
|
||||||
attr_accessor :extra
|
attr_accessor :extra
|
||||||
|
|
||||||
COMPONENTS ||= %w[
|
COMPONENTS = %w[
|
||||||
user_archive
|
user_archive
|
||||||
preferences
|
preferences
|
||||||
auth_tokens
|
auth_tokens
|
||||||
|
@ -25,7 +25,7 @@ module Jobs
|
||||||
visits
|
visits
|
||||||
]
|
]
|
||||||
|
|
||||||
HEADER_ATTRS_FOR ||=
|
HEADER_ATTRS_FOR =
|
||||||
HashWithIndifferentAccess.new(
|
HashWithIndifferentAccess.new(
|
||||||
user_archive: %w[
|
user_archive: %w[
|
||||||
topic_title
|
topic_title
|
||||||
|
|
|
@ -93,8 +93,7 @@ module Jobs
|
||||||
@skip_context = { type: type, user_id: user_id, to_address: to_address, post_id: post_id }
|
@skip_context = { type: type, user_id: user_id, to_address: to_address, post_id: post_id }
|
||||||
end
|
end
|
||||||
|
|
||||||
NOTIFICATIONS_SENT_BY_MAILING_LIST ||=
|
NOTIFICATIONS_SENT_BY_MAILING_LIST = Set.new %w[posted replied mentioned group_mentioned quoted]
|
||||||
Set.new %w[posted replied mentioned group_mentioned quoted]
|
|
||||||
|
|
||||||
def message_for_email(user, post, type, notification, args = nil)
|
def message_for_email(user, post, type, notification, args = nil)
|
||||||
args ||= {}
|
args ||= {}
|
||||||
|
|
|
@ -4,7 +4,7 @@ module Jobs
|
||||||
class UpdateAnimatedUploads < ::Jobs::Scheduled
|
class UpdateAnimatedUploads < ::Jobs::Scheduled
|
||||||
every 1.hour
|
every 1.hour
|
||||||
|
|
||||||
MAX_PROCESSED_GIF_IMAGES ||= 200
|
MAX_PROCESSED_GIF_IMAGES = 200
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
Upload
|
Upload
|
||||||
|
|
|
@ -6,7 +6,7 @@ class AdminDashboardData
|
||||||
cattr_reader :problem_messages, default: []
|
cattr_reader :problem_messages, default: []
|
||||||
|
|
||||||
# kept for backward compatibility
|
# kept for backward compatibility
|
||||||
GLOBAL_REPORTS ||= []
|
GLOBAL_REPORTS = []
|
||||||
|
|
||||||
PROBLEM_MESSAGE_PREFIX = "admin-problem:"
|
PROBLEM_MESSAGE_PREFIX = "admin-problem:"
|
||||||
SCHEDULED_PROBLEM_STORAGE_KEY = "admin-found-scheduled-problems-list"
|
SCHEDULED_PROBLEM_STORAGE_KEY = "admin-found-scheduled-problems-list"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class BackupLocationSiteSetting < EnumSiteSetting
|
class BackupLocationSiteSetting < EnumSiteSetting
|
||||||
LOCAL ||= "local"
|
LOCAL = "local"
|
||||||
S3 ||= "s3"
|
S3 = "s3"
|
||||||
|
|
||||||
def self.valid_value?(val)
|
def self.valid_value?(val)
|
||||||
values.any? { |v| v[:value] == val }
|
values.any? { |v| v[:value] == val }
|
||||||
|
|
|
@ -4,7 +4,7 @@ module HasCustomFields
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
module Helpers
|
module Helpers
|
||||||
CUSTOM_FIELD_TRUE ||= %w[1 t true T True TRUE].freeze
|
CUSTOM_FIELD_TRUE = %w[1 t true T True TRUE].freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
class FieldDescriptor < Struct.new(:type, :max_length)
|
class FieldDescriptor < Struct.new(:type, :max_length)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Draft < ActiveRecord::Base
|
class Draft < ActiveRecord::Base
|
||||||
NEW_TOPIC ||= "new_topic"
|
NEW_TOPIC = "new_topic"
|
||||||
NEW_PRIVATE_MESSAGE ||= "new_private_message"
|
NEW_PRIVATE_MESSAGE = "new_private_message"
|
||||||
EXISTING_TOPIC ||= "topic_"
|
EXISTING_TOPIC = "topic_"
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EmailLog < ActiveRecord::Base
|
class EmailLog < ActiveRecord::Base
|
||||||
CRITICAL_EMAIL_TYPES ||=
|
CRITICAL_EMAIL_TYPES =
|
||||||
Set.new %w[
|
Set.new %w[
|
||||||
account_created
|
account_created
|
||||||
admin_login
|
admin_login
|
||||||
|
|
|
@ -4,9 +4,9 @@ class Emoji
|
||||||
# update this to clear the cache
|
# update this to clear the cache
|
||||||
EMOJI_VERSION = "12"
|
EMOJI_VERSION = "12"
|
||||||
|
|
||||||
FITZPATRICK_SCALE ||= %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff]
|
FITZPATRICK_SCALE = %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff]
|
||||||
|
|
||||||
DEFAULT_GROUP ||= "default"
|
DEFAULT_GROUP = "default"
|
||||||
|
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@ class GlobalSetting
|
||||||
define_singleton_method(key) { provider.lookup(key, default) }
|
define_singleton_method(key) { provider.lookup(key, default) }
|
||||||
end
|
end
|
||||||
|
|
||||||
VALID_SECRET_KEY ||= /\A[0-9a-f]{128}\z/
|
VALID_SECRET_KEY = /\A[0-9a-f]{128}\z/
|
||||||
# this is named SECRET_TOKEN as opposed to SECRET_KEY_BASE
|
# this is named SECRET_TOKEN as opposed to SECRET_KEY_BASE
|
||||||
# for legacy reasons
|
# for legacy reasons
|
||||||
REDIS_SECRET_KEY ||= "SECRET_TOKEN"
|
REDIS_SECRET_KEY = "SECRET_TOKEN"
|
||||||
|
|
||||||
REDIS_VALIDATE_SECONDS ||= 30
|
REDIS_VALIDATE_SECONDS = 30
|
||||||
|
|
||||||
# In Rails secret_key_base is used to encrypt the cookie store
|
# In Rails secret_key_base is used to encrypt the cookie store
|
||||||
# the cookie store contains session data
|
# the cookie store contains session data
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ImapSyncLog < ActiveRecord::Base
|
class ImapSyncLog < ActiveRecord::Base
|
||||||
RETAIN_LOGS_DAYS ||= 5
|
RETAIN_LOGS_DAYS = 5
|
||||||
|
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class LocaleSiteSetting < EnumSiteSetting
|
||||||
@lock.synchronize { @values = @language_names = @supported_locales = nil }
|
@lock.synchronize { @values = @language_names = @supported_locales = nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
FALLBACKS ||= { en_GB: :en }
|
FALLBACKS = { en_GB: :en }
|
||||||
|
|
||||||
def self.fallback_locale(locale)
|
def self.fallback_locale(locale)
|
||||||
fallback_locale = FALLBACKS[locale.to_sym]
|
fallback_locale = FALLBACKS[locale.to_sym]
|
||||||
|
|
|
@ -6,7 +6,7 @@ class OptimizedImage < ActiveRecord::Base
|
||||||
|
|
||||||
# BUMP UP if optimized image algorithm changes
|
# BUMP UP if optimized image algorithm changes
|
||||||
VERSION = 2
|
VERSION = 2
|
||||||
URL_REGEX ||= %r{(/optimized/\dX[/\.\w]*/([a-zA-Z0-9]+)[\.\w]*)}
|
URL_REGEX = %r{(/optimized/\dX[/\.\w]*/([a-zA-Z0-9]+)[\.\w]*)}
|
||||||
|
|
||||||
def self.lock(upload_id, width, height)
|
def self.lock(upload_id, width, height)
|
||||||
@hostname ||= Discourse.os_hostname
|
@hostname ||= Discourse.os_hostname
|
||||||
|
@ -185,7 +185,7 @@ class OptimizedImage < ActiveRecord::Base
|
||||||
paths.each { |path| raise Discourse::InvalidAccess unless safe_path?(path) }
|
paths.each { |path| raise Discourse::InvalidAccess unless safe_path?(path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
IM_DECODERS ||= /\A(jpe?g|png|ico|gif|webp|avif)\z/i
|
IM_DECODERS = /\A(jpe?g|png|ico|gif|webp|avif)\z/i
|
||||||
|
|
||||||
def self.prepend_decoder!(path, ext_path = nil, opts = nil)
|
def self.prepend_decoder!(path, ext_path = nil, opts = nil)
|
||||||
opts ||= {}
|
opts ||= {}
|
||||||
|
|
|
@ -77,11 +77,11 @@ class Post < ActiveRecord::Base
|
||||||
:skip_unique_check,
|
:skip_unique_check,
|
||||||
:skip_validation
|
:skip_validation
|
||||||
|
|
||||||
MISSING_UPLOADS ||= "missing uploads"
|
MISSING_UPLOADS = "missing uploads"
|
||||||
MISSING_UPLOADS_IGNORED ||= "missing uploads ignored"
|
MISSING_UPLOADS_IGNORED = "missing uploads ignored"
|
||||||
NOTICE ||= "notice"
|
NOTICE = "notice"
|
||||||
|
|
||||||
SHORT_POST_CHARS ||= 1200
|
SHORT_POST_CHARS = 1200
|
||||||
|
|
||||||
register_custom_field_type(MISSING_UPLOADS, :json)
|
register_custom_field_type(MISSING_UPLOADS, :json)
|
||||||
register_custom_field_type(MISSING_UPLOADS_IGNORED, :boolean)
|
register_custom_field_type(MISSING_UPLOADS_IGNORED, :boolean)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RemoveMutedTagsFromLatestSiteSetting < EnumSiteSetting
|
class RemoveMutedTagsFromLatestSiteSetting < EnumSiteSetting
|
||||||
ALWAYS ||= "always"
|
ALWAYS = "always"
|
||||||
ONLY_MUTED ||= "only_muted"
|
ONLY_MUTED = "only_muted"
|
||||||
NEVER ||= "never"
|
NEVER = "never"
|
||||||
|
|
||||||
def self.valid_value?(val)
|
def self.valid_value?(val)
|
||||||
values.any? { |v| v[:value] == val }
|
values.any? { |v| v[:value] == val }
|
||||||
|
|
|
@ -697,7 +697,7 @@ class Topic < ActiveRecord::Base
|
||||||
!self.closed?
|
!self.closed?
|
||||||
end
|
end
|
||||||
|
|
||||||
MAX_SIMILAR_BODY_LENGTH ||= 200
|
MAX_SIMILAR_BODY_LENGTH = 200
|
||||||
|
|
||||||
def self.similar_to(title, raw, user = nil)
|
def self.similar_to(title, raw, user = nil)
|
||||||
return [] if SiteSetting.max_similar_results == 0
|
return [] if SiteSetting.max_similar_results == 0
|
||||||
|
@ -1728,7 +1728,7 @@ class Topic < ActiveRecord::Base
|
||||||
DB.exec(sql, user_id: user.id, topic_id: id) > 0
|
DB.exec(sql, user_id: user.id, topic_id: id) > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
TIME_TO_FIRST_RESPONSE_SQL ||= <<-SQL
|
TIME_TO_FIRST_RESPONSE_SQL = <<-SQL
|
||||||
SELECT AVG(t.hours)::float AS "hours", t.created_at AS "date"
|
SELECT AVG(t.hours)::float AS "hours", t.created_at AS "date"
|
||||||
FROM (
|
FROM (
|
||||||
SELECT t.id, t.created_at::date AS created_at, EXTRACT(EPOCH FROM MIN(p.created_at) - t.created_at)::float / 3600.0 AS "hours"
|
SELECT t.id, t.created_at::date AS created_at, EXTRACT(EPOCH FROM MIN(p.created_at) - t.created_at)::float / 3600.0 AS "hours"
|
||||||
|
@ -1741,7 +1741,7 @@ class Topic < ActiveRecord::Base
|
||||||
ORDER BY t.created_at
|
ORDER BY t.created_at
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
TIME_TO_FIRST_RESPONSE_TOTAL_SQL ||= <<-SQL
|
TIME_TO_FIRST_RESPONSE_TOTAL_SQL = <<-SQL
|
||||||
SELECT AVG(t.hours)::float AS "hours"
|
SELECT AVG(t.hours)::float AS "hours"
|
||||||
FROM (
|
FROM (
|
||||||
SELECT t.id, EXTRACT(EPOCH FROM MIN(p.created_at) - t.created_at)::float / 3600.0 AS "hours"
|
SELECT t.id, EXTRACT(EPOCH FROM MIN(p.created_at) - t.created_at)::float / 3600.0 AS "hours"
|
||||||
|
@ -1787,7 +1787,7 @@ class Topic < ActiveRecord::Base
|
||||||
total.first["hours"].to_f.round(2)
|
total.first["hours"].to_f.round(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
WITH_NO_RESPONSE_SQL ||= <<-SQL
|
WITH_NO_RESPONSE_SQL = <<-SQL
|
||||||
SELECT COUNT(*) as count, tt.created_at AS "date"
|
SELECT COUNT(*) as count, tt.created_at AS "date"
|
||||||
FROM (
|
FROM (
|
||||||
SELECT t.id, t.created_at::date AS created_at, MIN(p.post_number) first_reply
|
SELECT t.id, t.created_at::date AS created_at, MIN(p.post_number) first_reply
|
||||||
|
@ -1822,7 +1822,7 @@ class Topic < ActiveRecord::Base
|
||||||
builder.query_hash
|
builder.query_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
WITH_NO_RESPONSE_TOTAL_SQL ||= <<-SQL
|
WITH_NO_RESPONSE_TOTAL_SQL = <<-SQL
|
||||||
SELECT COUNT(*) as count
|
SELECT COUNT(*) as count
|
||||||
FROM (
|
FROM (
|
||||||
SELECT t.id, MIN(p.post_number) first_reply
|
SELECT t.id, MIN(p.post_number) first_reply
|
||||||
|
|
|
@ -364,7 +364,7 @@ class User < ActiveRecord::Base
|
||||||
LAST_VISIT = -2
|
LAST_VISIT = -2
|
||||||
end
|
end
|
||||||
|
|
||||||
MAX_STAFF_DELETE_POST_COUNT ||= 5
|
MAX_STAFF_DELETE_POST_COUNT = 5
|
||||||
|
|
||||||
def self.user_tips
|
def self.user_tips
|
||||||
@user_tips ||=
|
@user_tips ||=
|
||||||
|
@ -1568,7 +1568,7 @@ class User < ActiveRecord::Base
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
USER_FIELD_PREFIX ||= "user_field_"
|
USER_FIELD_PREFIX = "user_field_"
|
||||||
|
|
||||||
def user_fields(field_ids = nil)
|
def user_fields(field_ids = nil)
|
||||||
field_ids = (@all_user_field_ids ||= UserField.pluck(:id)) if field_ids.nil?
|
field_ids = (@all_user_field_ids ||= UserField.pluck(:id)) if field_ids.nil?
|
||||||
|
@ -1711,7 +1711,7 @@ class User < ActiveRecord::Base
|
||||||
.pluck(:new_email)
|
.pluck(:new_email)
|
||||||
end
|
end
|
||||||
|
|
||||||
RECENT_TIME_READ_THRESHOLD ||= 60.days
|
RECENT_TIME_READ_THRESHOLD = 60.days
|
||||||
|
|
||||||
def self.preload_recent_time_read(users)
|
def self.preload_recent_time_read(users)
|
||||||
times =
|
times =
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserSearch
|
class UserSearch
|
||||||
MAX_SIZE_PRIORITY_MENTION ||= 500
|
MAX_SIZE_PRIORITY_MENTION = 500
|
||||||
|
|
||||||
def initialize(term, opts = {})
|
def initialize(term, opts = {})
|
||||||
@term = term.downcase
|
@term = term.downcase
|
||||||
|
|
|
@ -79,7 +79,7 @@ class UserSummary
|
||||||
user_counts(liked_users)
|
user_counts(liked_users)
|
||||||
end
|
end
|
||||||
|
|
||||||
REPLY_ACTIONS ||= [UserAction::RESPONSE, UserAction::QUOTE, UserAction::MENTION]
|
REPLY_ACTIONS = [UserAction::RESPONSE, UserAction::QUOTE, UserAction::MENTION]
|
||||||
|
|
||||||
def most_replied_to_users
|
def most_replied_to_users
|
||||||
replied_users = {}
|
replied_users = {}
|
||||||
|
|
|
@ -40,10 +40,10 @@ class UsernameValidator
|
||||||
errors.empty?
|
errors.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
CONFUSING_EXTENSIONS ||= /\.(js|json|css|htm|html|xml|jpg|jpeg|png|gif|bmp|ico|tif|tiff|woff)\z/i
|
CONFUSING_EXTENSIONS = /\.(js|json|css|htm|html|xml|jpg|jpeg|png|gif|bmp|ico|tif|tiff|woff)\z/i
|
||||||
MAX_CHARS ||= 60
|
MAX_CHARS = 60
|
||||||
|
|
||||||
ASCII_INVALID_CHAR_PATTERN ||= /[^\w.-]/
|
ASCII_INVALID_CHAR_PATTERN = /[^\w.-]/
|
||||||
# All Unicode characters except for alphabetic and numeric character, marks and underscores are invalid.
|
# All Unicode characters except for alphabetic and numeric character, marks and underscores are invalid.
|
||||||
# In addition to that, the following letters and nonspacing marks are invalid:
|
# In addition to that, the following letters and nonspacing marks are invalid:
|
||||||
# (U+034F) Combining Grapheme Joiner
|
# (U+034F) Combining Grapheme Joiner
|
||||||
|
@ -56,7 +56,7 @@ class UsernameValidator
|
||||||
# (U+FFA0) Halfwidth Hangul Filler
|
# (U+FFA0) Halfwidth Hangul Filler
|
||||||
# (U+FE00 - U+FE0F) "Variation Selectors" block
|
# (U+FE00 - U+FE0F) "Variation Selectors" block
|
||||||
# (U+E0100 - U+E01EF) "Variation Selectors Supplement" block
|
# (U+E0100 - U+E01EF) "Variation Selectors Supplement" block
|
||||||
UNICODE_INVALID_CHAR_PATTERN ||=
|
UNICODE_INVALID_CHAR_PATTERN =
|
||||||
/
|
/
|
||||||
[^\p{Alnum}\p{M}._-]|
|
[^\p{Alnum}\p{M}._-]|
|
||||||
[
|
[
|
||||||
|
@ -72,9 +72,9 @@ class UsernameValidator
|
||||||
\p{In Variation Selectors Supplement}
|
\p{In Variation Selectors Supplement}
|
||||||
]
|
]
|
||||||
/x
|
/x
|
||||||
INVALID_LEADING_CHAR_PATTERN ||= /\A[^\p{Alnum}\p{M}_]+/
|
INVALID_LEADING_CHAR_PATTERN = /\A[^\p{Alnum}\p{M}_]+/
|
||||||
INVALID_TRAILING_CHAR_PATTERN ||= /[^\p{Alnum}\p{M}]+\z/
|
INVALID_TRAILING_CHAR_PATTERN = /[^\p{Alnum}\p{M}]+\z/
|
||||||
REPEATED_SPECIAL_CHAR_PATTERN ||= /[-_.]{2,}/
|
REPEATED_SPECIAL_CHAR_PATTERN = /[-_.]{2,}/
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class PostSerializer < BasicPostSerializer
|
class PostSerializer < BasicPostSerializer
|
||||||
# To pass in additional information we might need
|
# To pass in additional information we might need
|
||||||
INSTANCE_VARS ||= %i[
|
INSTANCE_VARS = %i[
|
||||||
parent_post
|
parent_post
|
||||||
add_raw
|
add_raw
|
||||||
add_title
|
add_title
|
||||||
|
|
|
@ -379,7 +379,7 @@ class BadgeGranter
|
||||||
{ errors: e.message }
|
{ errors: e.message }
|
||||||
end
|
end
|
||||||
|
|
||||||
MAX_ITEMS_FOR_DELTA ||= 200
|
MAX_ITEMS_FOR_DELTA = 200
|
||||||
def self.backfill(badge, opts = nil)
|
def self.backfill(badge, opts = nil)
|
||||||
return unless SiteSetting.enable_badges
|
return unless SiteSetting.enable_badges
|
||||||
return unless badge.enabled
|
return unless badge.enabled
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PushNotificationPusher
|
class PushNotificationPusher
|
||||||
TOKEN_VALID_FOR_SECONDS ||= 5 * 60
|
TOKEN_VALID_FOR_SECONDS = 5 * 60
|
||||||
CONNECTION_TIMEOUT_SECONDS = 5
|
CONNECTION_TIMEOUT_SECONDS = 5
|
||||||
|
|
||||||
def self.push(user, payload)
|
def self.push(user, payload)
|
||||||
|
@ -108,8 +108,8 @@ class PushNotificationPusher
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MAX_ERRORS ||= 3
|
MAX_ERRORS = 3
|
||||||
MIN_ERROR_DURATION ||= 86_400 # 1 day
|
MIN_ERROR_DURATION = 86_400 # 1 day
|
||||||
|
|
||||||
def self.handle_generic_error(subscription, error, user, endpoint, message)
|
def self.handle_generic_error(subscription, error, user, endpoint, message)
|
||||||
subscription.error_count += 1
|
subscription.error_count += 1
|
||||||
|
|
|
@ -405,8 +405,8 @@ class SearchIndexer
|
||||||
html_scrubber.scrubbed.squish
|
html_scrubber.scrubbed.squish
|
||||||
end
|
end
|
||||||
|
|
||||||
MENTION_CLASSES ||= %w[mention mention-group]
|
MENTION_CLASSES = %w[mention mention-group]
|
||||||
ATTRIBUTES ||= %w[alt title href data-video-title]
|
ATTRIBUTES = %w[alt title href data-video-title]
|
||||||
|
|
||||||
def start_element(_name, attributes = [])
|
def start_element(_name, attributes = [])
|
||||||
attributes = Hash[*attributes.flatten]
|
attributes = Hash[*attributes.flatten]
|
||||||
|
|
|
@ -11,7 +11,7 @@ class StaffActionLogger
|
||||||
raise Discourse::InvalidParameters.new(:admin) unless @admin && @admin.is_a?(User)
|
raise Discourse::InvalidParameters.new(:admin) unless @admin && @admin.is_a?(User)
|
||||||
end
|
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]
|
||||||
|
|
||||||
def log_user_deletion(deleted_user, opts = {})
|
def log_user_deletion(deleted_user, opts = {})
|
||||||
unless deleted_user && deleted_user.is_a?(User)
|
unless deleted_user && deleted_user.is_a?(User)
|
||||||
|
@ -410,7 +410,7 @@ class StaffActionLogger
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
BADGE_FIELDS ||= %i[
|
BADGE_FIELDS = %i[
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
description
|
description
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class WordWatcher
|
class WordWatcher
|
||||||
REPLACEMENT_LETTER ||= CGI.unescape_html("■")
|
REPLACEMENT_LETTER = CGI.unescape_html("■")
|
||||||
CACHE_VERSION ||= 3
|
CACHE_VERSION = 3
|
||||||
|
|
||||||
def initialize(raw)
|
def initialize(raw)
|
||||||
@raw = raw
|
@raw = raw
|
||||||
|
|
|
@ -4,7 +4,7 @@ require "migration/column_dropper"
|
||||||
require "badge_posts_view_manager"
|
require "badge_posts_view_manager"
|
||||||
|
|
||||||
class RemoveSuperfluousColumns < ActiveRecord::Migration[5.2]
|
class RemoveSuperfluousColumns < ActiveRecord::Migration[5.2]
|
||||||
DROPPED_COLUMNS ||= {
|
DROPPED_COLUMNS = {
|
||||||
user_profiles: %i[card_image_badge_id],
|
user_profiles: %i[card_image_badge_id],
|
||||||
categories: %i[logo_url background_url suppress_from_homepage],
|
categories: %i[logo_url background_url suppress_from_homepage],
|
||||||
groups: %i[visible public alias_level],
|
groups: %i[visible public alias_level],
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/table_dropper"
|
require "migration/table_dropper"
|
||||||
|
|
||||||
class RemoveSuperfluousTables < ActiveRecord::Migration[5.2]
|
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]
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/column_dropper"
|
require "migration/column_dropper"
|
||||||
|
|
||||||
class RemoveUploadedMetaIdFromCategory < ActiveRecord::Migration[5.2]
|
class RemoveUploadedMetaIdFromCategory < ActiveRecord::Migration[5.2]
|
||||||
DROPPED_COLUMNS ||= { categories: %i[uploaded_meta_id] }
|
DROPPED_COLUMNS = { categories: %i[uploaded_meta_id] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/column_dropper"
|
require "migration/column_dropper"
|
||||||
|
|
||||||
class DropEmailUserOptionsColumns < ActiveRecord::Migration[5.2]
|
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] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/column_dropper"
|
require "migration/column_dropper"
|
||||||
|
|
||||||
class RemoveViaEmailFromInvite < ActiveRecord::Migration[5.2]
|
class RemoveViaEmailFromInvite < ActiveRecord::Migration[5.2]
|
||||||
DROPPED_COLUMNS ||= { invites: %i[via_email] }
|
DROPPED_COLUMNS = { invites: %i[via_email] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RemoveSuppressFromLatestFromCategory < ActiveRecord::Migration[6.0]
|
class RemoveSuppressFromLatestFromCategory < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= { categories: %i[suppress_from_latest] }
|
DROPPED_COLUMNS = { categories: %i[suppress_from_latest] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
ids = DB.query_single("SELECT id::text FROM categories WHERE suppress_from_latest = TRUE")
|
ids = DB.query_single("SELECT id::text FROM categories WHERE suppress_from_latest = TRUE")
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/table_dropper"
|
require "migration/table_dropper"
|
||||||
|
|
||||||
class DropUnusedGoogleInstagramAuthTables < ActiveRecord::Migration[6.0]
|
class DropUnusedGoogleInstagramAuthTables < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_TABLES ||= %i[google_user_infos instagram_user_infos]
|
DROPPED_TABLES = %i[google_user_infos instagram_user_infos]
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
class RemoveKeyFromApiKeys < ActiveRecord::Migration[6.0]
|
class RemoveKeyFromApiKeys < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= { api_keys: %i[key] }
|
DROPPED_COLUMNS = { api_keys: %i[key] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropUnusedColumns < ActiveRecord::Migration[6.0]
|
class DropUnusedColumns < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= {
|
DROPPED_COLUMNS = {
|
||||||
post_replies: %i[reply_id],
|
post_replies: %i[reply_id],
|
||||||
user_profiles: %i[card_background profile_background],
|
user_profiles: %i[card_background profile_background],
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RemoveKeyFromUserApiKey < ActiveRecord::Migration[6.0]
|
class RemoveKeyFromUserApiKey < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= { user_api_keys: %i[key] }
|
DROPPED_COLUMNS = { user_api_keys: %i[key] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropAutomaticMembershipRetroactiveFromGroup < ActiveRecord::Migration[6.0]
|
class DropAutomaticMembershipRetroactiveFromGroup < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= { groups: %i[automatic_membership_retroactive] }
|
DROPPED_COLUMNS = { groups: %i[automatic_membership_retroactive] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropTopicReplyCount < ActiveRecord::Migration[6.0]
|
class DropTopicReplyCount < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= { user_stats: %i[topic_reply_count] }
|
DROPPED_COLUMNS = { user_stats: %i[topic_reply_count] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropPathWhitelistFromEmbeddableHosts < ActiveRecord::Migration[6.0]
|
class DropPathWhitelistFromEmbeddableHosts < ActiveRecord::Migration[6.0]
|
||||||
DROPPED_COLUMNS ||= { embeddable_hosts: %i[path_whitelist] }
|
DROPPED_COLUMNS = { embeddable_hosts: %i[path_whitelist] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropDurationColumnFromTopicTimers < ActiveRecord::Migration[6.1]
|
class DropDurationColumnFromTopicTimers < ActiveRecord::Migration[6.1]
|
||||||
DROPPED_COLUMNS ||= { topic_timers: %i[duration] }
|
DROPPED_COLUMNS = { topic_timers: %i[duration] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropDisableJumpReplyColumnFromUserOptions < ActiveRecord::Migration[6.1]
|
class DropDisableJumpReplyColumnFromUserOptions < ActiveRecord::Migration[6.1]
|
||||||
DROPPED_COLUMNS ||= { user_options: %i[disable_jump_reply] }
|
DROPPED_COLUMNS = { user_options: %i[disable_jump_reply] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropUploadsVerified < ActiveRecord::Migration[6.1]
|
class DropUploadsVerified < ActiveRecord::Migration[6.1]
|
||||||
DROPPED_COLUMNS ||= { uploads: %i[verified] }
|
DROPPED_COLUMNS = { uploads: %i[verified] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropTokenFromEmailTokens < ActiveRecord::Migration[6.1]
|
class DropTokenFromEmailTokens < ActiveRecord::Migration[6.1]
|
||||||
DROPPED_COLUMNS ||= { email_tokens: %i[token] }
|
DROPPED_COLUMNS = { email_tokens: %i[token] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/column_dropper"
|
require "migration/column_dropper"
|
||||||
|
|
||||||
class DropOldBookmarkColumns < ActiveRecord::Migration[6.1]
|
class DropOldBookmarkColumns < ActiveRecord::Migration[6.1]
|
||||||
DROPPED_COLUMNS ||= { bookmarks: %i[topic_id reminder_type] }
|
DROPPED_COLUMNS = { bookmarks: %i[topic_id reminder_type] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropCategoryRequiredTagGroupColumns < ActiveRecord::Migration[6.1]
|
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] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropFlairUrlFromGroups < ActiveRecord::Migration[7.0]
|
class DropFlairUrlFromGroups < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { groups: %i[flair_url] }
|
DROPPED_COLUMNS = { groups: %i[flair_url] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/column_dropper"
|
require "migration/column_dropper"
|
||||||
|
|
||||||
class DropOldBookmarkColumnsV2 < ActiveRecord::Migration[7.0]
|
class DropOldBookmarkColumnsV2 < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { bookmarks: %i[post_id for_topic] }
|
DROPPED_COLUMNS = { bookmarks: %i[post_id for_topic] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/column_dropper"
|
require "migration/column_dropper"
|
||||||
|
|
||||||
class RemoveTopicCountFromTags < ActiveRecord::Migration[7.0]
|
class RemoveTopicCountFromTags < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { tags: %i[topic_count] }
|
DROPPED_COLUMNS = { tags: %i[topic_count] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropBadgeGrantedTitleColumn < ActiveRecord::Migration[7.0]
|
class DropBadgeGrantedTitleColumn < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { user_profiles: %i[badge_granted_title] }
|
DROPPED_COLUMNS = { user_profiles: %i[badge_granted_title] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropPostUploadsTable < ActiveRecord::Migration[7.0]
|
class DropPostUploadsTable < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_TABLES ||= %i[post_uploads]
|
DROPPED_TABLES = %i[post_uploads]
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropBadgeImageColumn < ActiveRecord::Migration[7.0]
|
class DropBadgeImageColumn < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { badges: %i[image] }
|
DROPPED_COLUMNS = { badges: %i[image] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropDeprecatedColumns < ActiveRecord::Migration[7.0]
|
class DropDeprecatedColumns < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= {
|
DROPPED_COLUMNS = {
|
||||||
categories: %i[suppress_from_latest required_tag_group_id min_tags_from_required_group],
|
categories: %i[suppress_from_latest required_tag_group_id min_tags_from_required_group],
|
||||||
directory_columns: %i[automatic],
|
directory_columns: %i[automatic],
|
||||||
email_tokens: %i[token],
|
email_tokens: %i[token],
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SwapFieldTypeWithFieldTypeEnumOnUserFields < ActiveRecord::Migration[7.0]
|
class SwapFieldTypeWithFieldTypeEnumOnUserFields < ActiveRecord::Migration[7.0]
|
||||||
# DROPPED_COLUMNS ||= { user_fields: %i[field_type] }
|
# DROPPED_COLUMNS = { user_fields: %i[field_type] }
|
||||||
|
|
||||||
# def up
|
# def up
|
||||||
# # WARNING: Swapping in a column of a different type in a post-migration will break the AR
|
# # WARNING: Swapping in a column of a different type in a post-migration will break the AR
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropCompiledJsFromTranslationOverrides < ActiveRecord::Migration[7.1]
|
class DropCompiledJsFromTranslationOverrides < ActiveRecord::Migration[7.1]
|
||||||
DROPPED_COLUMNS ||= { translation_overrides: %i[compiled_js] }
|
DROPPED_COLUMNS = { translation_overrides: %i[compiled_js] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropCustomTypeFromFlags < ActiveRecord::Migration[7.0]
|
class DropCustomTypeFromFlags < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { flags: %i[custom_type] }
|
DROPPED_COLUMNS = { flags: %i[custom_type] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropGroupsSmtpSsl < ActiveRecord::Migration[7.1]
|
class DropGroupsSmtpSsl < ActiveRecord::Migration[7.1]
|
||||||
DROPPED_COLUMNS ||= { groups: %i[smtp_ssl] }
|
DROPPED_COLUMNS = { groups: %i[smtp_ssl] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
|
@ -23,28 +23,28 @@ require_relative "../route_matcher"
|
||||||
# We'll drop support for v0 after Discourse 2.9 is released.
|
# We'll drop support for v0 after Discourse 2.9 is released.
|
||||||
|
|
||||||
class Auth::DefaultCurrentUserProvider
|
class Auth::DefaultCurrentUserProvider
|
||||||
CURRENT_USER_KEY ||= "_DISCOURSE_CURRENT_USER"
|
CURRENT_USER_KEY = "_DISCOURSE_CURRENT_USER"
|
||||||
USER_TOKEN_KEY ||= "_DISCOURSE_USER_TOKEN"
|
USER_TOKEN_KEY = "_DISCOURSE_USER_TOKEN"
|
||||||
API_KEY ||= "api_key"
|
API_KEY = "api_key"
|
||||||
API_USERNAME ||= "api_username"
|
API_USERNAME = "api_username"
|
||||||
HEADER_API_KEY ||= "HTTP_API_KEY"
|
HEADER_API_KEY = "HTTP_API_KEY"
|
||||||
HEADER_API_USERNAME ||= "HTTP_API_USERNAME"
|
HEADER_API_USERNAME = "HTTP_API_USERNAME"
|
||||||
HEADER_API_USER_EXTERNAL_ID ||= "HTTP_API_USER_EXTERNAL_ID"
|
HEADER_API_USER_EXTERNAL_ID = "HTTP_API_USER_EXTERNAL_ID"
|
||||||
HEADER_API_USER_ID ||= "HTTP_API_USER_ID"
|
HEADER_API_USER_ID = "HTTP_API_USER_ID"
|
||||||
PARAMETER_USER_API_KEY ||= "user_api_key"
|
PARAMETER_USER_API_KEY = "user_api_key"
|
||||||
USER_API_KEY ||= "HTTP_USER_API_KEY"
|
USER_API_KEY = "HTTP_USER_API_KEY"
|
||||||
USER_API_CLIENT_ID ||= "HTTP_USER_API_CLIENT_ID"
|
USER_API_CLIENT_ID = "HTTP_USER_API_CLIENT_ID"
|
||||||
API_KEY_ENV ||= "_DISCOURSE_API"
|
API_KEY_ENV = "_DISCOURSE_API"
|
||||||
USER_API_KEY_ENV ||= "_DISCOURSE_USER_API"
|
USER_API_KEY_ENV = "_DISCOURSE_USER_API"
|
||||||
TOKEN_COOKIE ||= ENV["DISCOURSE_TOKEN_COOKIE"] || "_t"
|
TOKEN_COOKIE = ENV["DISCOURSE_TOKEN_COOKIE"] || "_t"
|
||||||
PATH_INFO ||= "PATH_INFO"
|
PATH_INFO = "PATH_INFO"
|
||||||
COOKIE_ATTEMPTS_PER_MIN ||= 10
|
COOKIE_ATTEMPTS_PER_MIN = 10
|
||||||
BAD_TOKEN ||= "_DISCOURSE_BAD_TOKEN"
|
BAD_TOKEN = "_DISCOURSE_BAD_TOKEN"
|
||||||
DECRYPTED_AUTH_COOKIE = "_DISCOURSE_DECRYPTED_AUTH_COOKIE"
|
DECRYPTED_AUTH_COOKIE = "_DISCOURSE_DECRYPTED_AUTH_COOKIE"
|
||||||
|
|
||||||
TOKEN_SIZE = 32
|
TOKEN_SIZE = 32
|
||||||
|
|
||||||
PARAMETER_API_PATTERNS ||= [
|
PARAMETER_API_PATTERNS = [
|
||||||
RouteMatcher.new(
|
RouteMatcher.new(
|
||||||
methods: :get,
|
methods: :get,
|
||||||
actions: [
|
actions: [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Auth::FacebookAuthenticator < Auth::ManagedAuthenticator
|
class Auth::FacebookAuthenticator < Auth::ManagedAuthenticator
|
||||||
AVATAR_SIZE ||= 480
|
AVATAR_SIZE = 480
|
||||||
|
|
||||||
def name
|
def name
|
||||||
"facebook"
|
"facebook"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Auth::GoogleOAuth2Authenticator < Auth::ManagedAuthenticator
|
class Auth::GoogleOAuth2Authenticator < Auth::ManagedAuthenticator
|
||||||
GROUPS_SCOPE ||= "https://www.googleapis.com/auth/admin.directory.group.readonly"
|
GROUPS_SCOPE = "https://www.googleapis.com/auth/admin.directory.group.readonly"
|
||||||
GROUPS_DOMAIN ||= "admin.googleapis.com"
|
GROUPS_DOMAIN = "admin.googleapis.com"
|
||||||
GROUPS_PATH ||= "/admin/directory/v1/groups"
|
GROUPS_PATH = "/admin/directory/v1/groups"
|
||||||
OAUTH2_BASE_URL ||= "https://oauth2.googleapis.com"
|
OAUTH2_BASE_URL = "https://oauth2.googleapis.com"
|
||||||
|
|
||||||
def name
|
def name
|
||||||
"google_oauth2"
|
"google_oauth2"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module BackupRestore
|
module BackupRestore
|
||||||
class S3BackupStore < BackupStore
|
class S3BackupStore < BackupStore
|
||||||
UPLOAD_URL_EXPIRES_AFTER_SECONDS ||= 6.hours.to_i
|
UPLOAD_URL_EXPIRES_AFTER_SECONDS = 6.hours.to_i
|
||||||
|
|
||||||
delegate :abort_multipart,
|
delegate :abort_multipart,
|
||||||
:presign_multipart_part,
|
:presign_multipart_part,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require "migration/base_dropper"
|
require "migration/base_dropper"
|
||||||
|
|
||||||
class DbHelper
|
class DbHelper
|
||||||
REMAP_SQL ||= <<~SQL
|
REMAP_SQL = <<~SQL
|
||||||
SELECT table_name::text, column_name::text, character_maximum_length
|
SELECT table_name::text, column_name::text, character_maximum_length
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema = 'public'
|
WHERE table_schema = 'public'
|
||||||
|
@ -12,13 +12,13 @@ class DbHelper
|
||||||
ORDER BY table_name, column_name
|
ORDER BY table_name, column_name
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
TRIGGERS_SQL ||= <<~SQL
|
TRIGGERS_SQL = <<~SQL
|
||||||
SELECT trigger_name::text
|
SELECT trigger_name::text
|
||||||
FROM information_schema.triggers
|
FROM information_schema.triggers
|
||||||
WHERE trigger_name LIKE '%_readonly'
|
WHERE trigger_name LIKE '%_readonly'
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
TRUNCATABLE_COLUMNS ||= ["topic_links.url"]
|
TRUNCATABLE_COLUMNS = ["topic_links.url"]
|
||||||
|
|
||||||
def self.remap(
|
def self.remap(
|
||||||
from,
|
from,
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
require "demon/base"
|
require "demon/base"
|
||||||
|
|
||||||
class Demon::EmailSync < ::Demon::Base
|
class Demon::EmailSync < ::Demon::Base
|
||||||
HEARTBEAT_KEY ||= "email_sync_heartbeat"
|
HEARTBEAT_KEY = "email_sync_heartbeat"
|
||||||
HEARTBEAT_INTERVAL ||= 60.seconds
|
HEARTBEAT_INTERVAL = 60.seconds
|
||||||
|
|
||||||
def self.prefix
|
def self.prefix
|
||||||
"email_sync"
|
"email_sync"
|
||||||
|
|
|
@ -7,15 +7,15 @@ require "version"
|
||||||
require "git_utils"
|
require "git_utils"
|
||||||
|
|
||||||
module Discourse
|
module Discourse
|
||||||
DB_POST_MIGRATE_PATH ||= "db/post_migrate"
|
DB_POST_MIGRATE_PATH = "db/post_migrate"
|
||||||
REQUESTED_HOSTNAME ||= "REQUESTED_HOSTNAME"
|
REQUESTED_HOSTNAME = "REQUESTED_HOSTNAME"
|
||||||
MAX_METADATA_FILE_SIZE = 64.kilobytes
|
MAX_METADATA_FILE_SIZE = 64.kilobytes
|
||||||
|
|
||||||
class Utils
|
class Utils
|
||||||
URI_REGEXP ||= URI.regexp(%w[http https])
|
URI_REGEXP = URI.regexp(%w[http https])
|
||||||
|
|
||||||
# TODO: Remove this once we drop support for Ruby 2.
|
# TODO: Remove this once we drop support for Ruby 2.
|
||||||
EMPTY_KEYWORDS ||= {}
|
EMPTY_KEYWORDS = {}
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# Discourse::Utils.execute_command("pwd", chdir: 'mydirectory')
|
# Discourse::Utils.execute_command("pwd", chdir: 'mydirectory')
|
||||||
|
@ -658,17 +658,17 @@ module Discourse
|
||||||
|
|
||||||
LAST_POSTGRES_READONLY_KEY = "postgres:last_readonly"
|
LAST_POSTGRES_READONLY_KEY = "postgres:last_readonly"
|
||||||
|
|
||||||
READONLY_MODE_KEY_TTL ||= 60
|
READONLY_MODE_KEY_TTL = 60
|
||||||
READONLY_MODE_KEY ||= "readonly_mode"
|
READONLY_MODE_KEY = "readonly_mode"
|
||||||
PG_READONLY_MODE_KEY ||= "readonly_mode:postgres"
|
PG_READONLY_MODE_KEY = "readonly_mode:postgres"
|
||||||
PG_READONLY_MODE_KEY_TTL ||= 300
|
PG_READONLY_MODE_KEY_TTL = 300
|
||||||
USER_READONLY_MODE_KEY ||= "readonly_mode:user"
|
USER_READONLY_MODE_KEY = "readonly_mode:user"
|
||||||
PG_FORCE_READONLY_MODE_KEY ||= "readonly_mode:postgres_force"
|
PG_FORCE_READONLY_MODE_KEY = "readonly_mode:postgres_force"
|
||||||
|
|
||||||
# Pseudo readonly mode, where staff can still write
|
# Pseudo readonly mode, where staff can still write
|
||||||
STAFF_WRITES_ONLY_MODE_KEY ||= "readonly_mode:staff_writes_only"
|
STAFF_WRITES_ONLY_MODE_KEY = "readonly_mode:staff_writes_only"
|
||||||
|
|
||||||
READONLY_KEYS ||= [
|
READONLY_KEYS = [
|
||||||
READONLY_MODE_KEY,
|
READONLY_MODE_KEY,
|
||||||
PG_READONLY_MODE_KEY,
|
PG_READONLY_MODE_KEY,
|
||||||
USER_READONLY_MODE_KEY,
|
USER_READONLY_MODE_KEY,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module DiscourseTagging
|
module DiscourseTagging
|
||||||
TAGS_FIELD_NAME ||= "tags"
|
TAGS_FIELD_NAME = "tags"
|
||||||
TAGS_FILTER_REGEXP ||= /[\/\?#\[\]@!\$&'\(\)\*\+,;=\.%\\`^\s|\{\}"<>]+/ # /?#[]@!$&'()*+,;=.%\`^|{}"<>
|
TAGS_FILTER_REGEXP = /[\/\?#\[\]@!\$&'\(\)\*\+,;=\.%\\`^\s|\{\}"<>]+/ # /?#[]@!$&'()*+,;=.%\`^|{}"<>
|
||||||
TAGS_STAFF_CACHE_KEY ||= "staff_tag_names"
|
TAGS_STAFF_CACHE_KEY = "staff_tag_names"
|
||||||
|
|
||||||
TAG_GROUP_TAG_IDS_SQL ||= <<-SQL
|
TAG_GROUP_TAG_IDS_SQL = <<-SQL
|
||||||
SELECT tag_id
|
SELECT tag_id
|
||||||
FROM tag_group_memberships tgm
|
FROM tag_group_memberships tgm
|
||||||
INNER JOIN tag_groups tg
|
INNER JOIN tag_groups tg
|
||||||
|
@ -370,7 +370,7 @@ module DiscourseTagging
|
||||||
tags_by_group_map.select { |_, group_tags| group_tags.size > 1 }
|
tags_by_group_map.select { |_, group_tags| group_tags.size > 1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
TAG_GROUP_RESTRICTIONS_SQL ||= <<~SQL
|
TAG_GROUP_RESTRICTIONS_SQL = <<~SQL
|
||||||
tag_group_restrictions AS (
|
tag_group_restrictions AS (
|
||||||
SELECT t.id as tag_id, tgm.id as tgm_id, tg.id as tag_group_id, tg.parent_tag_id as parent_tag_id,
|
SELECT t.id as tag_id, tgm.id as tgm_id, tg.id as tag_group_id, tg.parent_tag_id as parent_tag_id,
|
||||||
tg.one_per_topic as one_per_topic
|
tg.one_per_topic as one_per_topic
|
||||||
|
@ -380,7 +380,7 @@ module DiscourseTagging
|
||||||
)
|
)
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
CATEGORY_RESTRICTIONS_SQL ||= <<~SQL
|
CATEGORY_RESTRICTIONS_SQL = <<~SQL
|
||||||
category_restrictions AS (
|
category_restrictions AS (
|
||||||
SELECT t.id as tag_id, ct.id as ct_id, ct.category_id as category_id, NULL AS category_tag_group_id
|
SELECT t.id as tag_id, ct.id as ct_id, ct.category_id as category_id, NULL AS category_tag_group_id
|
||||||
FROM tags t
|
FROM tags t
|
||||||
|
@ -395,7 +395,7 @@ module DiscourseTagging
|
||||||
)
|
)
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PERMITTED_TAGS_SQL ||= <<~SQL
|
PERMITTED_TAGS_SQL = <<~SQL
|
||||||
permitted_tag_groups AS (
|
permitted_tag_groups AS (
|
||||||
SELECT tg.id as tag_group_id, tgp.group_id as group_id, tgp.permission_type as permission_type
|
SELECT tg.id as tag_group_id, tgp.group_id as group_id, tgp.permission_type as permission_type
|
||||||
FROM tags t
|
FROM tags t
|
||||||
|
|
|
@ -95,7 +95,7 @@ module Email
|
||||||
attr_reader :mail
|
attr_reader :mail
|
||||||
attr_reader :message_id
|
attr_reader :message_id
|
||||||
|
|
||||||
COMMON_ENCODINGS ||= [-"utf-8", -"windows-1252", -"iso-8859-1"]
|
COMMON_ENCODINGS = [-"utf-8", -"windows-1252", -"iso-8859-1"]
|
||||||
|
|
||||||
def self.formats
|
def self.formats
|
||||||
@formats ||= Enum.new(plaintext: 1, markdown: 2)
|
@formats ||= Enum.new(plaintext: 1, markdown: 2)
|
||||||
|
@ -527,7 +527,7 @@ module Email
|
||||||
[EmailReplyTrimmer.trim(markdown), elided_markdown]
|
[EmailReplyTrimmer.trim(markdown), elided_markdown]
|
||||||
end
|
end
|
||||||
|
|
||||||
HTML_EXTRACTERS ||= [
|
HTML_EXTRACTERS = [
|
||||||
[:gmail, /class="gmail_(signature|extra)/],
|
[:gmail, /class="gmail_(signature|extra)/],
|
||||||
[:outlook, /id="(divRplyFwdMsg|Signature)"/],
|
[:outlook, /id="(divRplyFwdMsg|Signature)"/],
|
||||||
[:word, /class="WordSection1"/],
|
[:word, /class="WordSection1"/],
|
||||||
|
|
|
@ -5,9 +5,9 @@ module FileStore
|
||||||
end
|
end
|
||||||
|
|
||||||
class BaseStore
|
class BaseStore
|
||||||
UPLOAD_PATH_REGEX ||= %r{/(original/\d+X/.*)}
|
UPLOAD_PATH_REGEX = %r{/(original/\d+X/.*)}
|
||||||
OPTIMIZED_IMAGE_PATH_REGEX ||= %r{/(optimized/\d+X/.*)}
|
OPTIMIZED_IMAGE_PATH_REGEX = %r{/(optimized/\d+X/.*)}
|
||||||
TEMPORARY_UPLOAD_PREFIX ||= "temp/"
|
TEMPORARY_UPLOAD_PREFIX = "temp/"
|
||||||
|
|
||||||
def store_upload(file, upload, content_type = nil)
|
def store_upload(file, upload, content_type = nil)
|
||||||
upload.url = nil
|
upload.url = nil
|
||||||
|
|
|
@ -8,7 +8,7 @@ require "file_helper"
|
||||||
|
|
||||||
module FileStore
|
module FileStore
|
||||||
class S3Store < BaseStore
|
class S3Store < BaseStore
|
||||||
TOMBSTONE_PREFIX ||= "tombstone/"
|
TOMBSTONE_PREFIX = "tombstone/"
|
||||||
|
|
||||||
delegate :abort_multipart,
|
delegate :abort_multipart,
|
||||||
:presign_multipart_part,
|
:presign_multipart_part,
|
||||||
|
|
|
@ -6,8 +6,8 @@ module FileStore
|
||||||
ToS3MigrationError = Class.new(RuntimeError)
|
ToS3MigrationError = Class.new(RuntimeError)
|
||||||
|
|
||||||
class ToS3Migration
|
class ToS3Migration
|
||||||
MISSING_UPLOADS_RAKE_TASK_NAME ||= "posts:missing_uploads"
|
MISSING_UPLOADS_RAKE_TASK_NAME = "posts:missing_uploads"
|
||||||
UPLOAD_CONCURRENCY ||= 20
|
UPLOAD_CONCURRENCY = 20
|
||||||
|
|
||||||
def initialize(s3_options:, dry_run: false, migrate_to_multisite: false)
|
def initialize(s3_options:, dry_run: false, migrate_to_multisite: false)
|
||||||
@s3_bucket = s3_options[:bucket]
|
@s3_bucket = s3_options[:bucket]
|
||||||
|
|
|
@ -157,7 +157,7 @@ class HtmlToMarkdown
|
||||||
send(visitor, node) if respond_to?(visitor, true)
|
send(visitor, node) if respond_to?(visitor, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
ALLOWED_IMG_SRCS ||= %w[http:// https:// www.]
|
ALLOWED_IMG_SRCS = %w[http:// https:// www.]
|
||||||
|
|
||||||
def allowed_hrefs
|
def allowed_hrefs
|
||||||
@allowed_hrefs ||=
|
@allowed_hrefs ||=
|
||||||
|
@ -195,7 +195,7 @@ class HtmlToMarkdown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ALLOWED ||= %w[kbd del ins small big sub sup dl dd dt mark]
|
ALLOWED = %w[kbd del ins small big sub sup dl dd dt mark]
|
||||||
ALLOWED.each do |tag|
|
ALLOWED.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
"<#{tag}>#{traverse(node, within_html_block: true)}</#{tag}>"
|
"<#{tag}>#{traverse(node, within_html_block: true)}</#{tag}>"
|
||||||
|
@ -210,7 +210,7 @@ class HtmlToMarkdown
|
||||||
"\n\n#{text}\n\n"
|
"\n\n#{text}\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
BLOCKS ||= %w[div tr]
|
BLOCKS = %w[div tr]
|
||||||
BLOCKS.each do |tag|
|
BLOCKS.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
prefix = block?(node.previous_element) ? "" : "\n"
|
prefix = block?(node.previous_element) ? "" : "\n"
|
||||||
|
@ -222,7 +222,7 @@ class HtmlToMarkdown
|
||||||
"\n\n#{traverse(node)}\n\n"
|
"\n\n#{traverse(node)}\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
TRAVERSABLES ||= %w[aside font span thead tbody tfoot u center]
|
TRAVERSABLES = %w[aside font span thead tbody tfoot u center]
|
||||||
TRAVERSABLES.each { |tag| define_method("visit_#{tag}") { |node| traverse(node) } }
|
TRAVERSABLES.each { |tag| define_method("visit_#{tag}") { |node| traverse(node) } }
|
||||||
|
|
||||||
def visit_tt(node)
|
def visit_tt(node)
|
||||||
|
@ -290,7 +290,7 @@ class HtmlToMarkdown
|
||||||
@within_html_block ? "<tr>\n#{text}</tr>\n" : text
|
@within_html_block ? "<tr>\n#{text}</tr>\n" : text
|
||||||
end
|
end
|
||||||
|
|
||||||
TABLE_CELLS ||= %w[th td]
|
TABLE_CELLS = %w[th td]
|
||||||
TABLE_CELLS.each do |tag|
|
TABLE_CELLS.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
text = traverse(node)
|
text = traverse(node)
|
||||||
|
@ -306,7 +306,7 @@ class HtmlToMarkdown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
LISTS ||= %w[ul ol]
|
LISTS = %w[ul ol]
|
||||||
LISTS.each do |tag|
|
LISTS.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
prefix = block?(node.previous_element) ? "" : "\n"
|
prefix = block?(node.previous_element) ? "" : "\n"
|
||||||
|
@ -330,7 +330,7 @@ class HtmlToMarkdown
|
||||||
"#{marker}#{text}#{suffix}"
|
"#{marker}#{text}#{suffix}"
|
||||||
end
|
end
|
||||||
|
|
||||||
EMPHASES ||= %w[i em]
|
EMPHASES = %w[i em]
|
||||||
EMPHASES.each do |tag|
|
EMPHASES.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
text = traverse(node)
|
text = traverse(node)
|
||||||
|
@ -347,7 +347,7 @@ class HtmlToMarkdown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
STRONGS ||= %w[b strong]
|
STRONGS = %w[b strong]
|
||||||
STRONGS.each do |tag|
|
STRONGS.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
text = traverse(node)
|
text = traverse(node)
|
||||||
|
@ -364,7 +364,7 @@ class HtmlToMarkdown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
STRIKES ||= %w[s strike]
|
STRIKES = %w[s strike]
|
||||||
STRIKES.each do |tag|
|
STRIKES.each do |tag|
|
||||||
define_method("visit_#{tag}") do |node|
|
define_method("visit_#{tag}") do |node|
|
||||||
text = traverse(node)
|
text = traverse(node)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Migration
|
module Migration
|
||||||
class BaseDropper
|
class BaseDropper
|
||||||
FUNCTION_SCHEMA_NAME ||= "discourse_functions"
|
FUNCTION_SCHEMA_NAME = "discourse_functions"
|
||||||
|
|
||||||
def self.create_readonly_function(table_name, column_name = nil)
|
def self.create_readonly_function(table_name, column_name = nil)
|
||||||
DB.exec <<~SQL
|
DB.exec <<~SQL
|
||||||
|
|
|
@ -10,8 +10,8 @@ module Onebox
|
||||||
requires_iframe_origins "https://www.youtube.com"
|
requires_iframe_origins "https://www.youtube.com"
|
||||||
always_https
|
always_https
|
||||||
|
|
||||||
WIDTH ||= 480
|
WIDTH = 480
|
||||||
HEIGHT ||= 360
|
HEIGHT = 360
|
||||||
|
|
||||||
def parse_embed_response
|
def parse_embed_response
|
||||||
return unless video_id
|
return unless video_id
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Onebox
|
||||||
class DownloadTooLarge < StandardError
|
class DownloadTooLarge < StandardError
|
||||||
end
|
end
|
||||||
|
|
||||||
IGNORE_CANONICAL_DOMAINS ||= %w[www.instagram.com medium.com youtube.com]
|
IGNORE_CANONICAL_DOMAINS = %w[www.instagram.com medium.com youtube.com]
|
||||||
|
|
||||||
def self.clean(html)
|
def self.clean(html)
|
||||||
html.gsub(/<[^>]+>/, " ").gsub(/\n/, "")
|
html.gsub(/<[^>]+>/, " ").gsub(/\n/, "")
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Onebox
|
||||||
# see https://bugs.ruby-lang.org/issues/14688
|
# see https://bugs.ruby-lang.org/issues/14688
|
||||||
client_exception =
|
client_exception =
|
||||||
defined?(Net::HTTPClientException) ? Net::HTTPClientException : Net::HTTPServerException
|
defined?(Net::HTTPClientException) ? Net::HTTPClientException : Net::HTTPServerException
|
||||||
WEB_EXCEPTIONS ||= [
|
WEB_EXCEPTIONS = [
|
||||||
client_exception,
|
client_exception,
|
||||||
OpenURI::HTTPError,
|
OpenURI::HTTPError,
|
||||||
Timeout::Error,
|
Timeout::Error,
|
||||||
|
|
|
@ -107,7 +107,7 @@ module Onebox
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
DISCOURSE_ONEBOX ||=
|
DISCOURSE_ONEBOX =
|
||||||
Sanitize::Config.freeze_config(
|
Sanitize::Config.freeze_config(
|
||||||
Sanitize::Config.merge(
|
Sanitize::Config.merge(
|
||||||
ONEBOX,
|
ONEBOX,
|
||||||
|
|
|
@ -153,9 +153,9 @@ class PlainTextToMarkdown
|
||||||
converted_text
|
converted_text
|
||||||
end
|
end
|
||||||
|
|
||||||
URL_REGEX ||= URI.regexp(%w[http https ftp mailto])
|
URL_REGEX = URI.regexp(%w[http https ftp mailto])
|
||||||
BEFORE ||= Regexp.escape(%Q|([<«"“'‘|)
|
BEFORE = Regexp.escape(%Q|([<«"“'‘|)
|
||||||
AFTER ||= Regexp.escape(%Q|)]>»"”'’|)
|
AFTER = Regexp.escape(%Q|)]>»"”'’|)
|
||||||
|
|
||||||
def replace_duplicate_links(text)
|
def replace_duplicate_links(text)
|
||||||
urls = Set.new
|
urls = Set.new
|
||||||
|
|
|
@ -6,7 +6,8 @@ require "plugin/metadata"
|
||||||
require "auth"
|
require "auth"
|
||||||
|
|
||||||
class Plugin::CustomEmoji
|
class Plugin::CustomEmoji
|
||||||
CACHE_KEY ||= "plugin-emoji"
|
CACHE_KEY = "plugin-emoji"
|
||||||
|
|
||||||
def self.cache_key
|
def self.cache_key
|
||||||
@@cache_key ||= CACHE_KEY
|
@@cache_key ||= CACHE_KEY
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Plugin
|
||||||
end
|
end
|
||||||
|
|
||||||
class Plugin::Metadata
|
class Plugin::Metadata
|
||||||
OFFICIAL_PLUGINS ||=
|
OFFICIAL_PLUGINS =
|
||||||
Set.new(
|
Set.new(
|
||||||
%w[
|
%w[
|
||||||
discourse-adplugin
|
discourse-adplugin
|
||||||
|
@ -97,10 +97,10 @@ class Plugin::Metadata
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
FIELDS ||= %i[name about version authors contact_emails url required_version meta_topic_id label]
|
FIELDS = %i[name about version authors contact_emails url required_version meta_topic_id label]
|
||||||
attr_accessor(*FIELDS)
|
attr_accessor(*FIELDS)
|
||||||
|
|
||||||
MAX_FIELD_LENGTHS ||= {
|
MAX_FIELD_LENGTHS = {
|
||||||
name: 75,
|
name: 75,
|
||||||
about: 350,
|
about: 350,
|
||||||
authors: 200,
|
authors: 200,
|
||||||
|
|
|
@ -42,7 +42,7 @@ class PresenceChannel
|
||||||
# allowed_group_ids: array of group_ids that can view, and become present in, the channel (default [])
|
# allowed_group_ids: array of group_ids that can view, and become present in, the channel (default [])
|
||||||
# count_only: boolean. If true, user identities are never revealed to clients. (default [])
|
# count_only: boolean. If true, user identities are never revealed to clients. (default [])
|
||||||
class Config
|
class Config
|
||||||
NOT_FOUND ||= "notfound"
|
NOT_FOUND = "notfound"
|
||||||
|
|
||||||
attr_accessor :public, :allowed_user_ids, :allowed_group_ids, :count_only, :timeout
|
attr_accessor :public, :allowed_user_ids, :allowed_group_ids, :count_only, :timeout
|
||||||
|
|
||||||
|
@ -76,11 +76,11 @@ class PresenceChannel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
DEFAULT_TIMEOUT ||= 60
|
DEFAULT_TIMEOUT = 60
|
||||||
CONFIG_CACHE_SECONDS ||= 10
|
CONFIG_CACHE_SECONDS = 10
|
||||||
GC_SECONDS ||= 24.hours.to_i
|
GC_SECONDS = 24.hours.to_i
|
||||||
MUTEX_TIMEOUT_SECONDS ||= 10
|
MUTEX_TIMEOUT_SECONDS = 10
|
||||||
MUTEX_LOCKED_ERROR ||= "PresenceChannel mutex is locked"
|
MUTEX_LOCKED_ERROR = "PresenceChannel mutex is locked"
|
||||||
|
|
||||||
@@configuration_blocks ||= {}
|
@@configuration_blocks ||= {}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ class PresenceChannel
|
||||||
end
|
end
|
||||||
LUA
|
LUA
|
||||||
|
|
||||||
LUA_SCRIPTS ||= {}
|
LUA_SCRIPTS = {}
|
||||||
|
|
||||||
LUA_SCRIPTS[:present] = DiscourseRedis::EvalHelper.new <<~LUA
|
LUA_SCRIPTS[:present] = DiscourseRedis::EvalHelper.new <<~LUA
|
||||||
#{COMMON_PRESENT_LEAVE_LUA}
|
#{COMMON_PRESENT_LEAVE_LUA}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RouteMatcher
|
class RouteMatcher
|
||||||
PATH_PARAMETERS ||= "_DISCOURSE_REQUEST_PATH_PARAMETERS"
|
PATH_PARAMETERS = "_DISCOURSE_REQUEST_PATH_PARAMETERS"
|
||||||
|
|
||||||
attr_reader :actions, :params, :methods, :aliases, :formats, :allowed_param_values
|
attr_reader :actions, :params, :methods, :aliases, :formats, :allowed_param_values
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ require "weakref"
|
||||||
|
|
||||||
module Scheduler
|
module Scheduler
|
||||||
module Deferrable
|
module Deferrable
|
||||||
DEFAULT_TIMEOUT ||= 90
|
DEFAULT_TIMEOUT = 90
|
||||||
STATS_CACHE_SIZE ||= 100
|
STATS_CACHE_SIZE = 100
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@async = !Rails.env.test?
|
@async = !Rails.env.test?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Search
|
class Search
|
||||||
DIACRITICS ||= /([\u0300-\u036f]|[\u1AB0-\u1AFF]|[\u1DC0-\u1DFF]|[\u20D0-\u20FF])/
|
DIACRITICS = /([\u0300-\u036f]|[\u1AB0-\u1AFF]|[\u1DC0-\u1DFF]|[\u20D0-\u20FF])/
|
||||||
HIGHLIGHT_CSS_CLASS = "search-highlight"
|
HIGHLIGHT_CSS_CLASS = "search-highlight"
|
||||||
|
|
||||||
cattr_accessor :preloaded_topic_custom_fields
|
cattr_accessor :preloaded_topic_custom_fields
|
||||||
|
|
|
@ -438,7 +438,7 @@ module SiteSettingExtension
|
||||||
refresh_settings.include?(name.to_sym)
|
refresh_settings.include?(name.to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
HOSTNAME_SETTINGS ||= %w[
|
HOSTNAME_SETTINGS = %w[
|
||||||
disabled_image_download_domains
|
disabled_image_download_domains
|
||||||
blocked_onebox_domains
|
blocked_onebox_domains
|
||||||
exclude_rel_nofollow_domains
|
exclude_rel_nofollow_domains
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Stylesheet
|
||||||
class Importer
|
class Importer
|
||||||
include GlobalPath
|
include GlobalPath
|
||||||
|
|
||||||
THEME_TARGETS ||= %w[embedded_theme mobile_theme desktop_theme]
|
THEME_TARGETS = %w[embedded_theme mobile_theme desktop_theme]
|
||||||
|
|
||||||
def self.plugin_assets
|
def self.plugin_assets
|
||||||
@plugin_assets ||= {}
|
@plugin_assets ||= {}
|
||||||
|
|
|
@ -12,9 +12,9 @@ class Stylesheet::Manager
|
||||||
CACHE_PATH = "tmp/stylesheet-cache"
|
CACHE_PATH = "tmp/stylesheet-cache"
|
||||||
private_constant :CACHE_PATH
|
private_constant :CACHE_PATH
|
||||||
|
|
||||||
MANIFEST_DIR ||= "#{Rails.root}/tmp/cache/assets/#{Rails.env}"
|
MANIFEST_DIR = "#{Rails.root}/tmp/cache/assets/#{Rails.env}"
|
||||||
THEME_REGEX ||= /_theme\z/
|
THEME_REGEX = /_theme\z/
|
||||||
COLOR_SCHEME_STYLESHEET ||= "color_definitions"
|
COLOR_SCHEME_STYLESHEET = "color_definitions"
|
||||||
|
|
||||||
@@lock = Mutex.new
|
@@lock = Mutex.new
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class TextSentinel
|
class TextSentinel
|
||||||
attr_accessor :text
|
attr_accessor :text
|
||||||
|
|
||||||
ENTROPY_SCALE ||= 0.7
|
ENTROPY_SCALE = 0.7
|
||||||
|
|
||||||
def initialize(text, opts = nil)
|
def initialize(text, opts = nil)
|
||||||
@opts = opts || {}
|
@opts = opts || {}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
require "fastimage"
|
require "fastimage"
|
||||||
|
|
||||||
class UploadCreator
|
class UploadCreator
|
||||||
TYPES_TO_CROP ||= %w[avatar card_background custom_emoji profile_background].each(&:freeze)
|
TYPES_TO_CROP = %w[avatar card_background custom_emoji profile_background].each(&:freeze)
|
||||||
|
|
||||||
ALLOWED_SVG_ELEMENTS ||= %w[
|
ALLOWED_SVG_ELEMENTS = %w[
|
||||||
circle
|
circle
|
||||||
clipPath
|
clipPath
|
||||||
defs
|
defs
|
||||||
|
@ -312,7 +312,7 @@ class UploadCreator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MIN_PIXELS_TO_CONVERT_TO_JPEG ||= 1280 * 720
|
MIN_PIXELS_TO_CONVERT_TO_JPEG = 1280 * 720
|
||||||
|
|
||||||
def convert_png_to_jpeg?
|
def convert_png_to_jpeg?
|
||||||
return false unless @image_info.type == :png
|
return false unless @image_info.type == :png
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Discourse
|
module Discourse
|
||||||
VERSION_REGEXP ||= /\A\d+\.\d+\.\d+(\.beta\d+)?\z/
|
VERSION_REGEXP = /\A\d+\.\d+\.\d+(\.beta\d+)?\z/
|
||||||
VERSION_COMPATIBILITY_FILENAME ||= ".discourse-compatibility"
|
VERSION_COMPATIBILITY_FILENAME = ".discourse-compatibility"
|
||||||
# work around reloader
|
# work around reloader
|
||||||
unless defined?(::Discourse::VERSION)
|
unless defined?(::Discourse::VERSION)
|
||||||
module VERSION #:nodoc:
|
module VERSION #:nodoc:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Chat::Api::ChannelsController < Chat::ApiController
|
class Chat::Api::ChannelsController < Chat::ApiController
|
||||||
CHANNEL_EDITABLE_PARAMS ||= %i[name description slug threading_enabled]
|
CHANNEL_EDITABLE_PARAMS = %i[name description slug threading_enabled]
|
||||||
CATEGORY_CHANNEL_EDITABLE_PARAMS ||= %i[auto_join_users allow_channel_wide_mentions]
|
CATEGORY_CHANNEL_EDITABLE_PARAMS = %i[auto_join_users allow_channel_wide_mentions]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
permitted = params.permit(:filter, :limit, :offset, :status)
|
permitted = params.permit(:filter, :limit, :offset, :status)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DropOldChatMessagePostIdActionCodeColumns < ActiveRecord::Migration[7.0]
|
class DropOldChatMessagePostIdActionCodeColumns < ActiveRecord::Migration[7.0]
|
||||||
DROPPED_COLUMNS ||= { chat_messages: %i[post_id action_code] }
|
DROPPED_COLUMNS = { chat_messages: %i[post_id action_code] }
|
||||||
|
|
||||||
def up
|
def up
|
||||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue