Skip to content

A platform for community discussion. Free, open, simple.

DEV: stop freezing frozen strings

Sam Saffrond0d5a138c3b6
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index 8481531b641..acb39e7cab2 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -24,7 +24,7 @@ class CategoriesController < ApplicationController
parent_category = Category.find_by_slug(params[:parent_category_id]) || Category.find_by(id: params[:parent_category_id].to_i)
category_options = {
- is_homepage: current_homepage == "categories".freeze,
+ is_homepage: current_homepage == "categories",
parent_category_id: params[:parent_category_id],
include_topics: include_topics(parent_category)
}
@@ -53,10 +53,10 @@ class CategoriesController < ApplicationController
no_definitions: true
}
- if style == "categories_and_latest_topics".freeze
+ if style == "categories_and_latest_topics"
@topic_list = TopicQuery.new(current_user, topic_options).list_latest
@topic_list.more_topics_url = url_for(public_send("latest_path"))
- elsif style == "categories_and_top_topics".freeze
+ elsif style == "categories_and_top_topics"
@topic_list = TopicQuery.new(nil, topic_options).list_top_for(SiteSetting.top_page_default_timeframe.to_sym)
@topic_list.more_topics_url = url_for(public_send("top_path"))
end
@@ -245,7 +245,7 @@ class CategoriesController < ApplicationController
discourse_expires_in 1.minute
category_options = {
- is_homepage: current_homepage == "categories".freeze,
+ is_homepage: current_homepage == "categories",
parent_category_id: params[:parent_category_id],
include_topics: false
}
@@ -354,8 +354,8 @@ class CategoriesController < ApplicationController
view_context.mobile_view? ||
params[:include_topics] ||
(parent_category && parent_category.subcategory_list_includes_topics?) ||
- style == "categories_with_featured_topics".freeze ||
- style == "categories_boxes_with_topics".freeze ||
- style == "categories_with_top_topics".freeze
+ style == "categories_with_featured_topics" ||
+ style == "categories_boxes_with_topics" ||
+ style == "categories_with_top_topics"
end
end
diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb
index 320abe17feb..347ff52312b 100644
--- a/app/controllers/webhooks_controller.rb
+++ b/app/controllers/webhooks_controller.rb
@@ -15,13 +15,13 @@ class WebhooksController < ActionController::Base
events.each do |event|
message_id = (event["smtp-id"] || "").tr("<>", "")
to_address = event["email"]
- if event["event"] == "bounce".freeze
+ if event["event"] == "bounce"
if event["status"]["4."]
process_bounce(message_id, to_address, SiteSetting.soft_bounce_score)
else
process_bounce(message_id, to_address, SiteSetting.hard_bounce_score)
end
- elsif event["event"] == "dropped".freeze
+ elsif event["event"] == "dropped"
process_bounce(message_id, to_address, SiteSetting.hard_bounce_score)
end
end
@@ -34,7 +34,7 @@ class WebhooksController < ActionController::Base
events.each do |event|
message_id = event["CustomID"]
to_address = event["email"]
- if event["event"] == "bounce".freeze
+ if event["event"] == "bounce"
if event["hard_bounce"]
process_bounce(message_id, to_address, SiteSetting.hard_bounce_score)
else
@@ -156,9 +156,9 @@ class WebhooksController < ActionController::Base
# only handle soft bounces, because hard bounces are also handled
# by the "dropped" event and we don't want to increase bounce score twice
# for the same message
- if event == "bounced".freeze && params["error"]["4."]
+ if event == "bounced" && params["error"]["4."]
process_bounce(message_id, to_address, SiteSetting.soft_bounce_score)
- elsif event == "dropped".freeze
+ elsif event == "dropped"
process_bounce(message_id, to_address, SiteSetting.hard_bounce_score)
end
@@ -174,10 +174,10 @@ class WebhooksController < ActionController::Base
to_address = data["recipient"]
severity = data["severity"]
- if data["event"] == "failed".freeze
- if severity == "temporary".freeze
+ if data["event"] == "failed"
+ if severity == "temporary"
process_bounce(message_id, to_address, SiteSetting.soft_bounce_score)
- elsif severity == "permanent".freeze
+ elsif severity == "permanent"
process_bounce(message_id, to_address, SiteSetting.hard_bounce_score)
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 00422273bbe..482b2477d3d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -36,7 +36,7 @@ module ApplicationHelper
end
def shared_session_key
- if SiteSetting.long_polling_base_url != '/'.freeze && current_user
+ if SiteSetting.long_polling_base_url != '/' && current_user
sk = "shared_session_key"
return request.env[sk] if request.env[sk]
@@ -282,7 +282,7 @@ module ApplicationHelper
'query-input' => 'required name=search_term_string',
}
}
- content_tag(:script, MultiJson.dump(json).html_safe, type: 'application/ld+json'.freeze)
+ content_tag(:script, MultiJson.dump(json).html_safe, type: 'application/ld+json')
end
def gsub_emoji_to_unicode(str)
diff --git a/app/jobs/regular/bulk_user_title_update.rb b/app/jobs/regular/bulk_user_title_update.rb
index 97d3f68ad53..e98c024a2fa 100644
--- a/app/jobs/regular/bulk_user_title_update.rb
+++ b/app/jobs/regular/bulk_user_title_update.rb
@@ -2,8 +2,8 @@
module Jobs
class BulkUserTitleUpdate < ::Jobs::Base
- UPDATE_ACTION = 'update'.freeze
- RESET_ACTION = 'reset'.freeze
+ UPDATE_ACTION = 'update'
+ RESET_ACTION = 'reset'
def execute(args)
new_title = args[:new_title]
diff --git a/app/jobs/regular/emit_web_hook_event.rb b/app/jobs/regular/emit_web_hook_event.rb
index 3c7fc3414c1..94371eaa33b 100644
--- a/app/jobs/regular/emit_web_hook_event.rb
+++ b/app/jobs/regular/emit_web_hook_event.rb
@@ -4,8 +4,8 @@ require 'excon'
module Jobs
class EmitWebHookEvent < ::Jobs::Base
- PING_EVENT = 'ping'.freeze
- MAX_RETRY_COUNT = 4.freeze
+ PING_EVENT = 'ping'
+ MAX_RETRY_COUNT = 4
RETRY_BACKOFF = 5
def execute(args)
diff --git a/app/jobs/scheduled/bookmark_reminder_notifications.rb b/app/jobs/scheduled/bookmark_reminder_notifications.rb
index 991e0d23c1d..4dca47c1f6c 100644
--- a/app/jobs/scheduled/bookmark_reminder_notifications.rb
+++ b/app/jobs/scheduled/bookmark_reminder_notifications.rb
@@ -6,7 +6,7 @@ module Jobs
# Any leftovers will be caught in the next run, because the reminder_at column
# is set to NULL once a reminder has been sent.
class BookmarkReminderNotifications < ::Jobs::Scheduled
- JOB_RUN_NUMBER_KEY ||= 'jobs_bookmark_reminder_notifications_job_run_num'.freeze
+ JOB_RUN_NUMBER_KEY ||= 'jobs_bookmark_reminder_notifications_job_run_num'
AT_DESKTOP_CONSISTENCY_RUN_NUMBER ||= 6
every 5.minutes
diff --git a/app/jobs/scheduled/pending_queued_posts_reminder.rb b/app/jobs/scheduled/pending_queued_posts_reminder.rb
index 29bc6709570..c3a283bd53d 100644
--- a/app/jobs/scheduled/pending_queued_posts_reminder.rb
+++ b/app/jobs/scheduled/pending_queued_posts_reminder.rb
@@ -41,7 +41,7 @@ module Jobs
end
def self.last_notified_key
- "last_notified_queued_post_id".freeze
+ "last_notified_queued_post_id"
end
end
end
diff --git a/app/jobs/scheduled/pending_reviewables_reminder.rb b/app/jobs/scheduled/pending_reviewables_reminder.rb
index df7a6a8aa36..3cc4b124a0a 100644
--- a/app/jobs/scheduled/pending_reviewables_reminder.rb
+++ b/app/jobs/scheduled/pending_reviewables_reminder.rb
@@ -45,7 +45,7 @@ module Jobs
end
def self.last_notified_key
- "last_notified_reviewable_id".freeze
+ "last_notified_reviewable_id"
end
def self.clear_key
diff --git a/app/jobs/scheduled/pending_users_reminder.rb b/app/jobs/scheduled/pending_users_reminder.rb
index 0c1be62ad86..33d212f3b2e 100644
--- a/app/jobs/scheduled/pending_users_reminder.rb
+++ b/app/jobs/scheduled/pending_users_reminder.rb
@@ -58,7 +58,7 @@ module Jobs
end
def previous_newest_username_cache_key
- "pending-users-reminder:newest-username".freeze
+ "pending-users-reminder:newest-username"
end
end
diff --git a/app/jobs/scheduled/poll_mailbox.rb b/app/jobs/scheduled/poll_mailbox.rb
index 178cbdb9bd7..8592ed3fe65 100644
--- a/app/jobs/scheduled/poll_mailbox.rb
+++ b/app/jobs/scheduled/poll_mailbox.rb
@@ -23,7 +23,7 @@ module Jobs
Email::Processor.process!(popmail.pop)
end
- POLL_MAILBOX_TIMEOUT_ERROR_KEY ||= "poll_mailbox_timeout_error_key".freeze
+ POLL_MAILBOX_TIMEOUT_ERROR_KEY ||= "poll_mailbox_timeout_error_key"
def poll_pop3
pop3 = Net::POP3.new(SiteSetting.pop3_polling_host, SiteSetting.pop3_polling_port)
@@ -62,7 +62,7 @@ module Jobs
Discourse.handle_job_exception(e, error_context(@args, "Signing in to poll incoming emails."))
end
- POLL_MAILBOX_ERRORS_KEY ||= "poll_mailbox_errors".freeze
+ POLL_MAILBOX_ERRORS_KEY ||= "poll_mailbox_errors"
def self.errors_in_past_24_hours
Discourse.redis.zremrangebyscore(POLL_MAILBOX_ERRORS_KEY, 0, 24.hours.ago.to_i)
diff --git a/app/models/category_featured_topic.rb b/app/models/category_featured_topic.rb
index 2848383605b..cfad73d7d8b 100644
--- a/app/models/category_featured_topic.rb
+++ b/app/models/category_featured_topic.rb
@@ -4,7 +4,7 @@ class CategoryFeaturedTopic < ActiveRecord::Base
belongs_to :category
belongs_to :topic
- NEXT_CATEGORY_ID_KEY = 'category-featured-topic:next-category-id'.freeze
+ NEXT_CATEGORY_ID_KEY = 'category-featured-topic:next-category-id'
DEFAULT_BATCH_SIZE = 100
# Populates the category featured topics.
diff --git a/app/models/category_list.rb b/app/models/category_list.rb
index 35dcaa7d3aa..5c81c1afbce 100644
--- a/app/models/category_list.rb
+++ b/app/models/category_list.rb
@@ -40,7 +40,7 @@ class CategoryList
end
def preload_key
- "categories_list".freeze
+ "categories_list"
end
def self.order_categories(categories)
diff --git a/app/models/concerns/category_hashtag.rb b/app/models/concerns/category_hashtag.rb
index 95b1521c251..c6745b01166 100644
--- a/app/models/concerns/category_hashtag.rb
+++ b/app/models/concerns/category_hashtag.rb
@@ -3,7 +3,7 @@
module CategoryHashtag
extend ActiveSupport::Concern
- SEPARATOR = ":".freeze
+ SEPARATOR = ":"
class_methods do
def query_from_hashtag_slug(category_slug)
diff --git a/app/models/emoji.rb b/app/models/emoji.rb
index e57fc3b81a4..cfd121b76ec 100644
--- a/app/models/emoji.rb
+++ b/app/models/emoji.rb
@@ -140,9 +140,9 @@ class Emoji
def self.replacement_code(code)
code
- .split('-'.freeze)
+ .split('-')
.map!(&:hex)
- .pack("U*".freeze)
+ .pack("U*")
end
def self.unicode_replacements
@@ -166,7 +166,7 @@ class Emoji
replacements[code] = name
if is_tonable_emojis.include?(name)
fitzpatrick_scales.each_with_index do |scale, index|
- toned_code = code.codepoints.insert(1, scale).pack("U*".freeze)
+ toned_code = code.codepoints.insert(1, scale).pack("U*")
replacements[toned_code] = "#{name}:t#{index + 2}"
end
end
diff --git a/app/models/topic.rb b/app/models/topic.rb
index dbc6c44d155..aaeca3f1453 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -228,7 +228,7 @@ class Topic < ActiveRecord::Base
end
after_save do
- banner = "banner".freeze
+ banner = "banner"
if archetype_before_last_save == banner || archetype == banner
ApplicationController.banner_json_cache.clear
diff --git a/app/models/topic_link.rb b/app/models/topic_link.rb
index 2fc9fd0b84e..f913dc64595 100644
--- a/app/models/topic_link.rb
+++ b/app/models/topic_link.rb
@@ -119,7 +119,7 @@ class TopicLink < ActiveRecord::Base
uri = UrlHelper.relaxed_parse(u.url)
[u, uri]
end
- .reject { |_, p| p.nil? || "mailto".freeze == p.scheme }
+ .reject { |_, p| p.nil? || "mailto" == p.scheme }
.uniq { |_, p| p }
.each do |link, parsed|
diff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rb
index 91838da99bb..df6516c382d 100644
--- a/app/models/topic_tracking_state.rb
+++ b/app/models/topic_tracking_state.rb
@@ -10,9 +10,9 @@ class TopicTrackingState
include ActiveModel::SerializerSupport
CHANNEL = "/user-tracking"
- UNREAD_MESSAGE_TYPE = "unread".freeze
- LATEST_MESSAGE_TYPE = "latest".freeze
- MUTED_MESSAGE_TYPE = "muted".freeze
+ UNREAD_MESSAGE_TYPE = "unread"
+ LATEST_MESSAGE_TYPE = "latest"
+ MUTED_MESSAGE_TYPE = "muted"
attr_accessor :user_id,
:topic_id,
diff --git a/app/models/upload.rb b/app/models/upload.rb
index 4cd7b926ced..cb4cf458afc 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -9,7 +9,7 @@ class Upload < ActiveRecord::Base
SHA1_LENGTH = 40
SEEDED_ID_THRESHOLD = 0
URL_REGEX ||= /(\/original\/\dX[\/\.\w]*\/([a-zA-Z0-9]+)[\.\w]*)/
- SECURE_MEDIA_ROUTE = "secure-media-uploads".freeze
+ SECURE_MEDIA_ROUTE = "secure-media-uploads"
belongs_to :user
belongs_to :access_control_post, class_name: 'Post'
diff --git a/app/models/user.rb b/app/models/user.rb
index 562291438f0..0beec5739aa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -352,7 +352,7 @@ class User < ActiveRecord::Base
end
EMAIL = %r{([^@]+)@([^\.]+)}
- FROM_STAGED = "from_staged".freeze
+ FROM_STAGED = "from_staged"
def self.new_from_params(params)
user = User.new
@@ -598,7 +598,7 @@ class User < ActiveRecord::Base
notification = notifications.visible.order('notifications.created_at desc').first
json = NotificationSerializer.new(notification).as_json if notification
- sql = (<<~SQL).freeze
+ sql = (<<~SQL)
SELECT * FROM (
SELECT n.id, n.read FROM notifications n
LEFT JOIN topics t ON n.topic_id = t.id
diff --git a/app/serializers/incoming_email_details_serializer.rb b/app/serializers/incoming_email_details_serializer.rb
index 420951bb8bb..d248a3ac588 100644
--- a/app/serializers/incoming_email_details_serializer.rb
+++ b/app/serializers/incoming_email_details_serializer.rb
@@ -15,7 +15,7 @@ class IncomingEmailDetailsSerializer < ApplicationSerializer
@mail = Mail.new(incoming_email.raw)
end
- EMAIL_RECEIVER_ERROR_PREFIX = "Email::Receiver::".freeze
+ EMAIL_RECEIVER_ERROR_PREFIX = "Email::Receiver::"
def error
@error_string.presence || I18n.t("emails.incoming.unrecognized_error")
diff --git a/app/services/badge_granter.rb b/app/services/badge_granter.rb
index 26b9262a3af..afa1a3cc3d3 100644
--- a/app/services/badge_granter.rb
+++ b/app/services/badge_granter.rb
@@ -180,7 +180,7 @@ class BadgeGranter
end
def self.queue_key
- "badge_queue".freeze
+ "badge_queue"
end
# Options:
diff --git a/config/initializers/100-silence_logger.rb b/config/initializers/100-silence_logger.rb
index 38fdbef5aad..3a900d24e37 100644
--- a/config/initializers/100-silence_logger.rb
+++ b/config/initializers/100-silence_logger.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
class SilenceLogger < Rails::Rack::Logger
- PATH_INFO = 'PATH_INFO'.freeze
- HTTP_X_SILENCE_LOGGER = 'HTTP_X_SILENCE_LOGGER'.freeze
+ PATH_INFO = 'PATH_INFO'
+ HTTP_X_SILENCE_LOGGER = 'HTTP_X_SILENCE_LOGGER'
def initialize(app, opts = {})
@app = app
@@ -36,9 +36,9 @@ class SilenceLogger < Rails::Rack::Logger
end
silenced = [
- "/mini-profiler-resources/results".freeze,
- "/mini-profiler-resources/includes.js".freeze,
- "/mini-profiler-resources/includes.css".freeze,
- "/mini-profiler-resources/jquery.tmpl.js".freeze
+ "/mini-profiler-resources/results",
+ "/mini-profiler-resources/includes.js",
+ "/mini-profiler-resources/includes.css",
+ "/mini-profiler-resources/jquery.tmpl.js"
]
Rails.configuration.middleware.swap Rails::Rack::Logger, SilenceLogger, silenced: silenced
diff --git a/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb b/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb
index ce37de7c14e..b8bfb629099 100644
--- a/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb
+++ b/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb
@@ -11,7 +11,7 @@ class PostgreSQLFallbackHandler
attr_reader :masters_down
attr_accessor :initialized
- DATABASE_DOWN_CHANNEL = '/global/database_down'.freeze
+ DATABASE_DOWN_CHANNEL = '/global/database_down'
def initialize
@masters_down = DistributedCache.new('masters_down', namespace: false)
diff --git a/lib/badge_posts_view_manager.rb b/lib/badge_posts_view_manager.rb
index 52ef2084c33..13b5d096072 100644
--- a/lib/badge_posts_view_manager.rb
+++ b/lib/badge_posts_view_manager.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class BadgePostsViewManager
- VIEW_NAME = "badge_posts".freeze
+ VIEW_NAME = "badge_posts"
def self.create!
sql = <<~SQL
diff --git a/lib/base62.rb b/lib/base62.rb
index f745922e634..70728c6a52d 100644
--- a/lib/base62.rb
+++ b/lib/base62.rb
@@ -3,7 +3,7 @@
# Modified version of: https://github.com/steventen/base62-rb
module Base62
- KEYS ||= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze
+ KEYS ||= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
KEYS_HASH ||= KEYS.each_char.with_index.to_h
BASE ||= KEYS.length
diff --git a/lib/bookmark_reminder_notification_handler.rb b/lib/bookmark_reminder_notification_handler.rb
index 3354be39494..e129b4ac195 100644
--- a/lib/bookmark_reminder_notification_handler.rb
+++ b/lib/bookmark_reminder_notification_handler.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class BookmarkReminderNotificationHandler
- PENDING_AT_DESKTOP_KEY_PREFIX ||= 'pending_at_desktop_bookmark_reminder_user_'.freeze
+ PENDING_AT_DESKTOP_KEY_PREFIX ||= 'pending_at_desktop_bookmark_reminder_user_'
PENDING_AT_DESKTOP_EXPIRY_DAYS ||= 20
def self.send_notification(bookmark)
diff --git a/lib/discourse.rb b/lib/discourse.rb
index 07810010b69..9bdbc2b3024 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -42,7 +42,7 @@ module Discourse
end
def self.pretty_logs(logs)
- logs.join("\n".freeze)
+ logs.join("\n")
end
def self.atomic_write_file(destination, contents)
@@ -811,7 +811,7 @@ module Discourse
warning
end
- SIDEKIQ_NAMESPACE ||= 'sidekiq'.freeze
+ SIDEKIQ_NAMESPACE ||= 'sidekiq'
def self.sidekiq_redis_config
conf = GlobalSetting.redis_config.dup
diff --git a/lib/discourse_redis.rb b/lib/discourse_redis.rb
index 728e244db74..ff946cacfb5 100644
--- a/lib/discourse_redis.rb
+++ b/lib/discourse_redis.rb
@@ -8,10 +8,10 @@ class DiscourseRedis
class FallbackHandler
include Singleton
- MASTER_ROLE_STATUS = "role:master".freeze
- MASTER_LOADING_STATUS = "loading:1".freeze
- MASTER_LOADED_STATUS = "loading:0".freeze
- CONNECTION_TYPES = %w{normal pubsub}.each(&:freeze)
+ MASTER_ROLE_STATUS = "role:master"
+ MASTER_LOADING_STATUS = "loading:1"
+ MASTER_LOADED_STATUS = "loading:0"
+ CONNECTION_TYPES = %w{normal pubsub}
def initialize
@master = true
diff --git a/lib/email/message_builder.rb b/lib/email/message_builder.rb
index 4dafa6bbf95..611cdca115d 100644
--- a/lib/email/message_builder.rb
+++ b/lib/email/message_builder.rb
@@ -6,7 +6,7 @@ module Email
class MessageBuilder
attr_reader :template_args
- ALLOW_REPLY_BY_EMAIL_HEADER = 'X-Discourse-Allow-Reply-By-Email'.freeze
+ ALLOW_REPLY_BY_EMAIL_HEADER = 'X-Discourse-Allow-Reply-By-Email'
def initialize(to, opts = nil)
@to = to
diff --git a/lib/email/styles.rb b/lib/email/styles.rb
index 4d299fcff32..34845f9df6f 100644
--- a/lib/email/styles.rb
+++ b/lib/email/styles.rb
@@ -337,8 +337,8 @@ module Email
def strip_classes_and_ids
@fragment.css('*').each do |element|
- element.delete('class'.freeze)
- element.delete('id'.freeze)
+ element.delete('class')
+ element.delete('id')
end
end
diff --git a/lib/file_store/base_store.rb b/lib/file_store/base_store.rb
index c3752be1557..6307465a8fc 100644
--- a/lib/file_store/base_store.rb
+++ b/lib/file_store/base_store.rb
@@ -121,14 +121,14 @@ module FileStore
File.extname(upload.original_filename)
end
- get_path_for("original".freeze, upload.id, upload.sha1, extension)
+ get_path_for("original", upload.id, upload.sha1, extension)
end
def get_path_for_optimized_image(optimized_image)
upload = optimized_image.upload
version = optimized_image.version || 1
extension = "_#{version}_#{optimized_image.width}x#{optimized_image.height}#{optimized_image.extension}"
- get_path_for("optimized".freeze, upload.id, upload.sha1, extension)
+ get_path_for("optimized", upload.id, upload.sha1, extension)
end
CACHE_DIR ||= "#{Rails.root}/tmp/download_cache/"
diff --git a/lib/html_prettify.rb b/lib/html_prettify.rb
index db3bd14e08f..06a00099b2b 100644
--- a/lib/html_prettify.rb
+++ b/lib/html_prettify.rb
@@ -240,11 +240,11 @@ class HtmlPrettify < String
def educate_fractions(str)
str.gsub(/(\s+|^)(1\/4|1\/2|3\/4)([,.;\s]|$)/) do
frac =
- if $2 == "1/2".freeze
+ if $2 == "1/2"
entity(:frac12)
- elsif $2 == "1/4".freeze
+ elsif $2 == "1/4"
entity(:frac14)
- elsif $2 == "3/4".freeze
+ elsif $2 == "3/4"
entity(:frac34)
end
"#{$1}#{frac}#{$3}"
diff --git a/lib/migration/base_dropper.rb b/lib/migration/base_dropper.rb
index 2ea01131e2f..b88a5ba3576 100644
--- a/lib/migration/base_dropper.rb
+++ b/lib/migration/base_dropper.rb
@@ -2,7 +2,7 @@
module Migration
class BaseDropper
- FUNCTION_SCHEMA_NAME ||= "discourse_functions".freeze
+ FUNCTION_SCHEMA_NAME ||= "discourse_functions"
def self.create_readonly_function(table_name, column_name = nil)
DB.exec <<~SQL
diff --git a/lib/plain_text_to_markdown.rb b/lib/plain_text_to_markdown.rb
index f365731130b..5cbe78a9347 100644
--- a/lib/plain_text_to_markdown.rb
+++ b/lib/plain_text_to_markdown.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class PlainTextToMarkdown
- SIGNATURE_SEPARATOR ||= "-- ".freeze
+ SIGNATURE_SEPARATOR ||= "-- "
def initialize(plaintext, opts = {})
@plaintext = plaintext
diff --git a/lib/post_creator.rb b/lib/post_creator.rb
index fab3de19543..6f91e35b5d8 100644
--- a/lib/post_creator.rb
+++ b/lib/post_creator.rb
@@ -240,7 +240,7 @@ class PostCreator
end
def self.track_post_stats
- Rails.env != "test".freeze || @track_post_stats
+ Rails.env != "test" || @track_post_stats
end
def self.track_post_stats=(val)
diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb
index 0843f32348f..8f260089efe 100644
--- a/lib/pretty_text.rb
+++ b/lib/pretty_text.rb
@@ -311,7 +311,7 @@ module PrettyText
# extract all links
doc.css("a").each do |a|
- if a["href"].present? && a["href"][0] != "#".freeze
+ if a["href"].present? && a["href"][0] != "#"
links << DetectedLink.new(a["href"], false)
end
end
diff --git a/lib/quote_comparer.rb b/lib/quote_comparer.rb
index e3aeb797172..5da2891a7e1 100644
--- a/lib/quote_comparer.rb
+++ b/lib/quote_comparer.rb
@@ -2,7 +2,7 @@
class QuoteComparer
def self.whitespace
- " \t\r\n".freeze
+ " \t\r\n"
end
def initialize(topic_id, post_number, text)
diff --git a/lib/s3_helper.rb b/lib/s3_helper.rb
index a1f921e9afa..ccc0da333ac 100644
--- a/lib/s3_helper.rb
+++ b/lib/s3_helper.rb
@@ -28,7 +28,7 @@ class S3Helper
end
def self.get_bucket_and_folder_path(s3_bucket_name)
- s3_bucket_name.downcase.split("/".freeze, 2)
+ s3_bucket_name.downcase.split("/", 2)
end
def upload(file, path, options = {})
@@ -75,7 +75,7 @@ class S3Helper
options[:copy_source] = File.join(@s3_bucket_name, source)
elsif @s3_bucket_folder_path
folder, filename = begin
- source.split("/".freeze, 2)
+ source.split("/", 2)
end
options[:copy_source] = File.join(@s3_bucket_name, folder, multisite_upload_path, filename)
else
diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb
index 2c651d0b612..64fe9d6d443 100644
--- a/lib/site_setting_extension.rb
+++ b/lib/site_setting_extension.rb
@@ -135,7 +135,7 @@ module SiteSettingExtension
if GlobalSetting.respond_to?(name)
val = GlobalSetting.public_send(name)
- unless val.nil? || (val == ''.freeze)
+ unless val.nil? || (val == '')
shadowed_val = val
hidden_settings << name
shadowed_settings << name
diff --git a/lib/topic_query.rb b/lib/topic_query.rb
index fa851e916ab..35bc7347feb 100644
--- a/lib/topic_query.rb
+++ b/lib/topic_query.rb
@@ -458,7 +458,7 @@ class TopicQuery
def latest_results(options = {})
result = default_results(options)
- result = remove_muted_topics(result, @user) unless options && options[:state] == "muted".freeze
+ result = remove_muted_topics(result, @user) unless options && options[:state] == "muted"
result = remove_muted_categories(result, @user, exclude: options[:category])
result = remove_muted_tags(result, @user, options)
result = apply_shared_drafts(result, get_category_id(options[:category]), options)
diff --git a/lib/twitter_api.rb b/lib/twitter_api.rb
index 8b9f0887673..2cef9c0847f 100644
--- a/lib/twitter_api.rb
+++ b/lib/twitter_api.rb
@@ -93,7 +93,7 @@ class TwitterApi
end
unless defined? BASE_URL
- BASE_URL = 'https://api.twitter.com'.freeze
+ BASE_URL = 'https://api.twitter.com'
end
def twitter_get(uri)
diff --git a/lib/validators/censored_words_validator.rb b/lib/validators/censored_words_validator.rb
index b65f6620e34..0c72e51a311 100644
--- a/lib/validators/censored_words_validator.rb
+++ b/lib/validators/censored_words_validator.rb
@@ -29,7 +29,7 @@ class CensoredWordsValidator < ActiveModel::EachValidator
def join_censored_words(censored_words)
censored_words.map!(&:downcase)
censored_words.uniq!
- censored_words.join(", ".freeze)
+ censored_words.join(", ")
end
def censored_words_regexp
diff --git a/lib/validators/regex_setting_validator.rb b/lib/validators/regex_setting_validator.rb
index aec1dbc1a6e..a0d85b9e5ee 100644
--- a/lib/validators/regex_setting_validator.rb
+++ b/lib/validators/regex_setting_validator.rb
@@ -2,7 +2,7 @@
class RegexSettingValidator
- LOREM = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eget sem non elit tincidunt rhoncus.'.freeze
+ LOREM = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eget sem non elit tincidunt rhoncus.'
def initialize(opts = {})
@opts = opts
diff --git a/lib/webauthn.rb b/lib/webauthn.rb
index 56705cfa233..4734b660ca9 100644
--- a/lib/webauthn.rb
+++ b/lib/webauthn.rb
@@ -5,8 +5,8 @@ require 'webauthn/security_key_registration_service'
require 'webauthn/security_key_authentication_service'
module Webauthn
- ACCEPTABLE_REGISTRATION_TYPE = "webauthn.create".freeze
- ACCEPTABLE_AUTHENTICATION_TYPE = "webauthn.get".freeze
+ ACCEPTABLE_REGISTRATION_TYPE = "webauthn.create"
+ ACCEPTABLE_AUTHENTICATION_TYPE = "webauthn.get"
# -7 - ES256
# -257 - RS256 (Windows Hello supported alg.)
diff --git a/script/bulk_import/base.rb b/script/bulk_import/base.rb
index 8af89155e1c..9fc7b1cd17a 100644
--- a/script/bulk_import/base.rb
+++ b/script/bulk_import/base.rb
@@ -26,7 +26,7 @@ module BulkImport; end
class BulkImport::Base
- NOW ||= "now()".freeze
+ NOW ||= "now()"
PRIVATE_OFFSET ||= 2**30
# rubocop:disable Layout/HashAlignment
@@ -660,7 +660,7 @@ class BulkImport::Base
imported_ids << mapped[:imported_id] unless mapped[:imported_id].nil?
imported_ids |= mapped[:imported_ids] unless mapped[:imported_ids].nil?
@raw_connection.put_copy_data columns.map { |c| processed[c] }
- print "\r%7d - %6d/sec".freeze % [imported_ids.size, imported_ids.size.to_f / (Time.now - start)] if imported_ids.size % 5000 == 0
+ print "\r%7d - %6d/sec" % [imported_ids.size, imported_ids.size.to_f / (Time.now - start)] if imported_ids.size % 5000 == 0
rescue => e
puts "\n"
puts "ERROR: #{e.inspect}"
@@ -669,7 +669,7 @@ class BulkImport::Base
end
if imported_ids.size > 0
- print "\r%7d - %6d/sec".freeze % [imported_ids.size, imported_ids.size.to_f / (Time.now - start)]
+ print "\r%7d - %6d/sec" % [imported_ids.size, imported_ids.size.to_f / (Time.now - start)]
puts
end
diff --git a/script/bulk_import/discourse_merger.rb b/script/bulk_import/discourse_merger.rb
index 9029bdb28a8..35ff800822c 100644
--- a/script/bulk_import/discourse_merger.rb
+++ b/script/bulk_import/discourse_merger.rb
@@ -4,7 +4,7 @@ require_relative "base"
class BulkImport::DiscourseMerger < BulkImport::Base
- NOW ||= "now()".freeze
+ NOW ||= "now()"
CUSTOM_FIELDS = ['category', 'group', 'post', 'topic', 'user']
# DB_NAME: name of database being merged into the current local db
diff --git a/script/bulk_import/vanilla.rb b/script/bulk_import/vanilla.rb
index 2efed5f31f7..71307dba0ac 100644
--- a/script/bulk_import/vanilla.rb
+++ b/script/bulk_import/vanilla.rb
@@ -209,7 +209,7 @@ class BulkImport::Vanilla < BulkImport::Base
User.find_each do |u|
count += 1
- print "\r%7d - %6d/sec".freeze % [count, count.to_f / (Time.now - start)]
+ print "\r%7d - %6d/sec" % [count, count.to_f / (Time.now - start)]
next unless u.custom_fields["import_id"]
@@ -276,7 +276,7 @@ class BulkImport::Vanilla < BulkImport::Base
Post.where("raw LIKE '%/us.v-cdn.net/%' OR raw LIKE '%[attachment%'").find_each do |post|
count += 1
- print "\r%7d - %6d/sec".freeze % [count, count.to_f / (Time.now - start)]
+ print "\r%7d - %6d/sec" % [count, count.to_f / (Time.now - start)]
new_raw = post.raw.dup
new_raw.gsub!(attachment_regex) do |s|
@@ -613,7 +613,7 @@ class BulkImport::Vanilla < BulkImport::Base
)
end
- print "\r%7d - %6d/sec".freeze % [count, count.to_f / (Time.now - start)] if count % 5000 == 0
+ print "\r%7d - %6d/sec" % [count, count.to_f / (Time.now - start)] if count % 5000 == 0
end
end
@@ -645,7 +645,7 @@ class BulkImport::Vanilla < BulkImport::Base
end
end
- print "\r%7d - %6d/sec".freeze % [count, count.to_f / (Time.now - start)] if count % 5000 == 0
+ print "\r%7d - %6d/sec" % [count, count.to_f / (Time.now - start)] if count % 5000 == 0
end
end
end
diff --git a/script/bulk_import/vbulletin.rb b/script/bulk_import/vbulletin.rb
index fef661fa91b..b437137c384 100644
--- a/script/bulk_import/vbulletin.rb
+++ b/script/bulk_import/vbulletin.rb
@@ -608,7 +608,7 @@ class BulkImport::VBulletin < BulkImport::Base
count = 0
Dir.foreach(AVATAR_DIR) do |item|
- print "\r%7d - %6d/sec".freeze % [count, count.to_f / (Time.now - start)]
+ print "\r%7d - %6d/sec" % [count, count.to_f / (Time.now - start)]
next if item == ('.') || item == ('..') || item == ('.DS_Store')
next unless item =~ /avatar(\d+)_(\d).gif/
diff --git a/script/import_scripts/mbox/support/indexer.rb b/script/import_scripts/mbox/support/indexer.rb
index 7017c2a59fd..dc6e092c294 100644
--- a/script/import_scripts/mbox/support/indexer.rb
+++ b/script/import_scripts/mbox/support/indexer.rb
@@ -39,7 +39,7 @@ module ImportScripts::Mbox
private
- METADATA_FILENAME = 'metadata.yml'.freeze
+ METADATA_FILENAME = 'metadata.yml'
IGNORED_FILE_EXTENSIONS = ['.dbindex', '.dbnames', '.digest', '.subjects', '.yml']
def index_category(directory)
diff --git a/spec/components/discourse_tagging_spec.rb b/spec/components/discourse_tagging_spec.rb
index 35ff67a9a9a..b8d328f9800 100644
--- a/spec/components/discourse_tagging_spec.rb
+++ b/spec/components/discourse_tagging_spec.rb
@@ -475,7 +475,7 @@ describe DiscourseTagging do
describe "clean_tag" do
it "downcases new tags if setting enabled" do
- expect(DiscourseTagging.clean_tag("HeLlO".freeze)).to eq("hello")
+ expect(DiscourseTagging.clean_tag("HeLlO")).to eq("hello")
SiteSetting.force_lowercase_tags = false
expect(DiscourseTagging.clean_tag("HeLlO")).to eq("HeLlO")
diff --git a/spec/support/webauthn_integration_helpers.rb b/spec/support/webauthn_integration_helpers.rb
index d6a32ffd354..09310d0f575 100644
--- a/spec/support/webauthn_integration_helpers.rb
+++ b/spec/support/webauthn_integration_helpers.rb
@@ -19,23 +19,23 @@ module WebauthnIntegrationHelpers
# simulate_localhost_webautn_challenge for a real example.
def valid_security_key_data
{
- credential_id: "9GiFosW50+s+juyJlyxKEVAsk3gZLo9XWIhX47eC4gHfDsldF3TWR43Tcl/+3gLTL5t1TjpmcbKA2DUV2eKrBw==".freeze,
- public_key: "pQECAyYgASFYIPMGM1OpSuCU5uks+BulAdfVxdlJiYcgGac5Y+LnLXC9Ilgghy0BKvRvptmQdtWz33Jjnf8Y6+HD85XdRiqmo1KMGPE=".freeze
+ credential_id: "9GiFosW50+s+juyJlyxKEVAsk3gZLo9XWIhX47eC4gHfDsldF3TWR43Tcl/+3gLTL5t1TjpmcbKA2DUV2eKrBw==",
+ public_key: "pQECAyYgASFYIPMGM1OpSuCU5uks+BulAdfVxdlJiYcgGac5Y+LnLXC9Ilgghy0BKvRvptmQdtWz33Jjnf8Y6+HD85XdRiqmo1KMGPE="
}
end
def valid_security_key_auth_post_data
{
- signature: "MEYCIQC5xyUQvF4qTPZ2yX7crp/IEs1E/4wqhXgxC1EVAumhfgIhAIC/7w4BVEy+ew6vMYISahtnnIqbqsPZosBeTUSI8Y4j".freeze,
- clientData: "eyJjaGFsbGVuZ2UiOiJOR1UzWW1Zek0yWTBNelkyWkdFM05EVTNZak5qWldVNFpUWTNOakJoTm1NMFlqVTVORFptTlRrd016Vm1ZMlZpTURVd01UZzJOemcxTW1RMSIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsInR5cGUiOiJ3ZWJhdXRobi5nZXQifQ==".freeze,
- authenticatorData: "SZYN5YgOjGh0NBcPZHZgW4/krrmihjLHmVzzuoMdl2MBAAAA2Q==".freeze,
+ signature: "MEYCIQC5xyUQvF4qTPZ2yX7crp/IEs1E/4wqhXgxC1EVAumhfgIhAIC/7w4BVEy+ew6vMYISahtnnIqbqsPZosBeTUSI8Y4j",
+ clientData: "eyJjaGFsbGVuZ2UiOiJOR1UzWW1Zek0yWTBNelkyWkdFM05EVTNZak5qWldVNFpUWTNOakJoTm1NMFlqVTVORFptTlRrd016Vm1ZMlZpTURVd01UZzJOemcxTW1RMSIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsInR5cGUiOiJ3ZWJhdXRobi5nZXQifQ==",
+ authenticatorData: "SZYN5YgOjGh0NBcPZHZgW4/krrmihjLHmVzzuoMdl2MBAAAA2Q==",
credentialId: valid_security_key_data[:credential_id]
}
end
def valid_security_key_challenge_data
{
- challenge: "4e7bf33f4366da7457b3cee8e6760a6c4b5946f59035fceb0501867852d5".freeze
+ challenge: "4e7bf33f4366da7457b3cee8e6760a6c4b5946f59035fceb0501867852d5"
}
end