DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
This commit is contained in:
parent
4e1f25197d
commit
30990006a9
|
@ -12,6 +12,9 @@ AllCops:
|
||||||
Style/AndOr:
|
Style/AndOr:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
# Do not use braces for hash literals when they are the last argument of a
|
# Do not use braces for hash literals when they are the last argument of a
|
||||||
# method call.
|
# method call.
|
||||||
Style/BracesAroundHashParameters:
|
Style/BracesAroundHashParameters:
|
||||||
|
|
2
Brewfile
2
Brewfile
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Install development dependencies on Mac OS X using Homebrew (http://mxcl.github.com/homebrew)
|
# Install development dependencies on Mac OS X using Homebrew (http://mxcl.github.com/homebrew)
|
||||||
|
|
||||||
# you probably already have git installed; ensure that it is the latest version
|
# you probably already have git installed; ensure that it is the latest version
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
if github.pr_json && (github.pr_json["additions"] || 0) > 250 || (github.pr_json["deletions"] || 0) > 250
|
if github.pr_json && (github.pr_json["additions"] || 0) > 250 || (github.pr_json["deletions"] || 0) > 250
|
||||||
warn("This pull request is big! We prefer smaller PRs whenever possible, as they are easier to review. Can this be split into a few smaller PRs?")
|
warn("This pull request is big! We prefer smaller PRs whenever possible, as they are easier to review. Can this be split into a few smaller PRs?")
|
||||||
end
|
end
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
# if there is a super emergency and rubygems is playing up, try
|
# if there is a super emergency and rubygems is playing up, try
|
||||||
#source 'http://production.cf.rubygems.org'
|
#source 'http://production.cf.rubygems.org'
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -1,4 +1,6 @@
|
||||||
#!/usr/bin/env rake
|
#!/usr/bin/env rake
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
require_dependency 'rate_limiter'
|
||||||
|
|
||||||
class AboutController < ApplicationController
|
class AboutController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'upload_creator'
|
require_dependency 'upload_creator'
|
||||||
|
|
||||||
class Admin::EmojisController < Admin::AdminController
|
class Admin::EmojisController < Admin::AdminController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'flag_query'
|
require_dependency 'flag_query'
|
||||||
|
|
||||||
class Admin::FlaggedTopicsController < Admin::AdminController
|
class Admin::FlaggedTopicsController < Admin::AdminController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'flag_query'
|
require 'flag_query'
|
||||||
|
|
||||||
class Admin::FlagsController < Admin::AdminController
|
class Admin::FlagsController < Admin::AdminController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::GroupsController < Admin::AdminController
|
class Admin::GroupsController < Admin::AdminController
|
||||||
def bulk
|
def bulk
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::ImpersonateController < Admin::AdminController
|
class Admin::ImpersonateController < Admin::AdminController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::PermalinksController < Admin::AdminController
|
class Admin::PermalinksController < Admin::AdminController
|
||||||
|
|
||||||
before_action :fetch_permalink, only: [:destroy]
|
before_action :fetch_permalink, only: [:destroy]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::PluginsController < Admin::AdminController
|
class Admin::PluginsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'report'
|
require_dependency 'report'
|
||||||
|
|
||||||
class Admin::ReportsController < Admin::AdminController
|
class Admin::ReportsController < Admin::AdminController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::ScreenedEmailsController < Admin::AdminController
|
class Admin::ScreenedEmailsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'ip_addr'
|
require_dependency 'ip_addr'
|
||||||
|
|
||||||
class Admin::ScreenedIpAddressesController < Admin::AdminController
|
class Admin::ScreenedIpAddressesController < Admin::AdminController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::ScreenedUrlsController < Admin::AdminController
|
class Admin::ScreenedUrlsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::SearchLogsController < Admin::AdminController
|
class Admin::SearchLogsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::SiteSettingsController < Admin::AdminController
|
class Admin::SiteSettingsController < Admin::AdminController
|
||||||
rescue_from Discourse::InvalidParameters do |e|
|
rescue_from Discourse::InvalidParameters do |e|
|
||||||
render_json_error e.message, status: 422
|
render_json_error e.message, status: 422
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'seed_data/categories'
|
require_dependency 'seed_data/categories'
|
||||||
require_dependency 'seed_data/topics'
|
require_dependency 'seed_data/topics'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::StaffActionLogsController < Admin::AdminController
|
class Admin::StaffActionLogsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -22,7 +24,7 @@ class Admin::StaffActionLogsController < Admin::AdminController
|
||||||
|
|
||||||
diff_fields = {}
|
diff_fields = {}
|
||||||
|
|
||||||
output = "<h2>#{CGI.escapeHTML(cur["name"].to_s)}</h2><p></p>"
|
output = +"<h2>#{CGI.escapeHTML(cur["name"].to_s)}</h2><p></p>"
|
||||||
|
|
||||||
diff_fields["name"] = {
|
diff_fields["name"] = {
|
||||||
prev: prev["name"].to_s,
|
prev: prev["name"].to_s,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'upload_creator'
|
require_dependency 'upload_creator'
|
||||||
require_dependency 'theme_store/tgz_exporter'
|
require_dependency 'theme_store/tgz_exporter'
|
||||||
require 'base64'
|
require 'base64'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::UserFieldsController < Admin::AdminController
|
class Admin::UserFieldsController < Admin::AdminController
|
||||||
|
|
||||||
def self.columns
|
def self.columns
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'user_destroyer'
|
require_dependency 'user_destroyer'
|
||||||
require_dependency 'admin_user_index_query'
|
require_dependency 'admin_user_index_query'
|
||||||
require_dependency 'admin_confirmation'
|
require_dependency 'admin_confirmation'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse_updates'
|
require_dependency 'discourse_updates'
|
||||||
|
|
||||||
class Admin::VersionsController < Admin::AdminController
|
class Admin::VersionsController < Admin::AdminController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::WatchedWordsController < Admin::AdminController
|
class Admin::WatchedWordsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Admin::WebHooksController < Admin::AdminController
|
class Admin::WebHooksController < Admin::AdminController
|
||||||
before_action :fetch_web_hook, only: %i(show update destroy list_events bulk_events ping)
|
before_action :fetch_web_hook, only: %i(show update destroy list_events bulk_events ping)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class BadgesController < ApplicationController
|
class BadgesController < ApplicationController
|
||||||
skip_before_action :check_xhr, only: [:index, :show]
|
skip_before_action :check_xhr, only: [:index, :show]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'category_serializer'
|
require_dependency 'category_serializer'
|
||||||
|
|
||||||
class CategoriesController < ApplicationController
|
class CategoriesController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class CategoryHashtagsController < ApplicationController
|
class CategoryHashtagsController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ClicksController < ApplicationController
|
class ClicksController < ApplicationController
|
||||||
skip_before_action :check_xhr, :preload_json, :verify_authenticity_token
|
skip_before_action :check_xhr, :preload_json, :verify_authenticity_token
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'html_to_markdown'
|
require_dependency 'html_to_markdown'
|
||||||
|
|
||||||
class ComposerController < ApplicationController
|
class ComposerController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'composer_messages_finder'
|
require_dependency 'composer_messages_finder'
|
||||||
|
|
||||||
class ComposerMessagesController < ApplicationController
|
class ComposerMessagesController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DirectoryItemsController < ApplicationController
|
class DirectoryItemsController < ApplicationController
|
||||||
PAGE_SIZE = 50
|
PAGE_SIZE = 50
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DraftController < ApplicationController
|
class DraftController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DraftsController < ApplicationController
|
class DraftsController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EmailController < ApplicationController
|
class EmailController < ApplicationController
|
||||||
layout 'no_ember'
|
layout 'no_ember'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EmbedController < ApplicationController
|
class EmbedController < ApplicationController
|
||||||
skip_before_action :check_xhr, :preload_json, :verify_authenticity_token
|
skip_before_action :check_xhr, :preload_json, :verify_authenticity_token
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ExceptionsController < ApplicationController
|
class ExceptionsController < ApplicationController
|
||||||
skip_before_action :check_xhr, :preload_json
|
skip_before_action :check_xhr, :preload_json
|
||||||
before_action :hide_search
|
before_action :hide_search
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ExportCsvController < ApplicationController
|
class ExportCsvController < ApplicationController
|
||||||
|
|
||||||
skip_before_action :preload_json, :check_xhr, only: [:show]
|
skip_before_action :preload_json, :check_xhr, only: [:show]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class FinishInstallationController < ApplicationController
|
class FinishInstallationController < ApplicationController
|
||||||
skip_before_action :check_xhr, :preload_json, :redirect_to_login_if_required
|
skip_before_action :check_xhr, :preload_json, :redirect_to_login_if_required
|
||||||
layout 'finish_installation'
|
layout 'finish_installation'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class GroupsController < ApplicationController
|
class GroupsController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class HighlightJsController < ApplicationController
|
class HighlightJsController < ApplicationController
|
||||||
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show]
|
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'inline_oneboxer'
|
require_dependency 'inline_oneboxer'
|
||||||
|
|
||||||
class InlineOneboxController < ApplicationController
|
class InlineOneboxController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
require_dependency 'rate_limiter'
|
||||||
|
|
||||||
class InvitesController < ApplicationController
|
class InvitesController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_list_responder'
|
require_dependency 'topic_list_responder'
|
||||||
|
|
||||||
class ListController < ApplicationController
|
class ListController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'notification_serializer'
|
require_dependency 'notification_serializer'
|
||||||
|
|
||||||
class NotificationsController < ApplicationController
|
class NotificationsController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class OfflineController < ApplicationController
|
class OfflineController < ApplicationController
|
||||||
layout false
|
layout false
|
||||||
skip_before_action :preload_json, :check_xhr, :redirect_to_login_if_required
|
skip_before_action :preload_json, :check_xhr, :redirect_to_login_if_required
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'oneboxer'
|
require_dependency 'oneboxer'
|
||||||
|
|
||||||
class OneboxController < ApplicationController
|
class OneboxController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PermalinksController < ApplicationController
|
class PermalinksController < ApplicationController
|
||||||
skip_before_action :check_xhr, :preload_json
|
skip_before_action :check_xhr, :preload_json
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse'
|
require_dependency 'discourse'
|
||||||
|
|
||||||
class PostActionUsersController < ApplicationController
|
class PostActionUsersController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse'
|
require_dependency 'discourse'
|
||||||
|
|
||||||
class PostActionsController < ApplicationController
|
class PostActionsController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'new_post_manager'
|
require_dependency 'new_post_manager'
|
||||||
require_dependency 'post_creator'
|
require_dependency 'post_creator'
|
||||||
require_dependency 'post_action_destroyer'
|
require_dependency 'post_action_destroyer'
|
||||||
|
@ -762,7 +764,7 @@ class PostsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def signature_for(args)
|
def signature_for(args)
|
||||||
"post##" << Digest::SHA1.hexdigest(args
|
+"post##" << Digest::SHA1.hexdigest(args
|
||||||
.to_h
|
.to_h
|
||||||
.to_a
|
.to_a
|
||||||
.concat([["user", current_user.id]])
|
.concat([["user", current_user.id]])
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PushNotificationController < ApplicationController
|
class PushNotificationController < ApplicationController
|
||||||
layout false
|
layout false
|
||||||
before_action :ensure_logged_in
|
before_action :ensure_logged_in
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'queued_post_serializer'
|
require_dependency 'queued_post_serializer'
|
||||||
|
|
||||||
class QueuedPostsController < ApplicationController
|
class QueuedPostsController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class QunitController < ApplicationController
|
class QunitController < ApplicationController
|
||||||
skip_before_action :check_xhr, :preload_json, :redirect_to_login_if_required
|
skip_before_action :check_xhr, :preload_json, :redirect_to_login_if_required
|
||||||
layout false
|
layout false
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RobotsTxtController < ApplicationController
|
class RobotsTxtController < ApplicationController
|
||||||
layout false
|
layout false
|
||||||
skip_before_action :preload_json, :check_xhr, :redirect_to_login_if_required
|
skip_before_action :preload_json, :check_xhr, :redirect_to_login_if_required
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SafeModeController < ApplicationController
|
class SafeModeController < ApplicationController
|
||||||
layout 'no_ember'
|
layout 'no_ember'
|
||||||
before_action :ensure_safe_mode_enabled
|
before_action :ensure_safe_mode_enabled
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'search'
|
require_dependency 'search'
|
||||||
|
|
||||||
class SearchController < ApplicationController
|
class SearchController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
require_dependency 'rate_limiter'
|
||||||
require_dependency 'single_sign_on'
|
require_dependency 'single_sign_on'
|
||||||
require_dependency 'single_sign_on_provider'
|
require_dependency 'single_sign_on_provider'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'similar_topic_serializer'
|
require_dependency 'similar_topic_serializer'
|
||||||
require_dependency 'search/grouped_search_results'
|
require_dependency 'search/grouped_search_results'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'site_serializer'
|
require_dependency 'site_serializer'
|
||||||
|
|
||||||
class SiteController < ApplicationController
|
class SiteController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'distributed_memoizer'
|
require_dependency 'distributed_memoizer'
|
||||||
require_dependency 'file_helper'
|
require_dependency 'file_helper'
|
||||||
|
|
||||||
|
@ -35,7 +37,7 @@ class StaticController < ApplicationController
|
||||||
@page = 'faq' if @page == 'guidelines'
|
@page = 'faq' if @page == 'guidelines'
|
||||||
|
|
||||||
# Don't allow paths like ".." or "/" or anything hacky like that
|
# Don't allow paths like ".." or "/" or anything hacky like that
|
||||||
@page.gsub!(/[^a-z0-9\_\-]/, '')
|
@page = @page.gsub(/[^a-z0-9\_\-]/, '')
|
||||||
|
|
||||||
if map.has_key?(@page)
|
if map.has_key?(@page)
|
||||||
@topic = Topic.find_by_id(SiteSetting.get(map[@page][:topic_id]))
|
@topic = Topic.find_by_id(SiteSetting.get(map[@page][:topic_id]))
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'wizard'
|
require_dependency 'wizard'
|
||||||
require_dependency 'wizard/builder'
|
require_dependency 'wizard/builder'
|
||||||
require_dependency 'wizard/step_updater'
|
require_dependency 'wizard/step_updater'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class StylesheetsController < ApplicationController
|
class StylesheetsController < ApplicationController
|
||||||
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show, :show_source_map]
|
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show, :show_source_map]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TagGroupsController < ApplicationController
|
class TagGroupsController < ApplicationController
|
||||||
|
|
||||||
requires_login
|
requires_login
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_list_responder'
|
require_dependency 'topic_list_responder'
|
||||||
require_dependency 'topics_bulk_action'
|
require_dependency 'topics_bulk_action'
|
||||||
require_dependency 'topic_query'
|
require_dependency 'topic_query'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ThemesController < ::ApplicationController
|
class ThemesController < ::ApplicationController
|
||||||
def assets
|
def assets
|
||||||
theme_ids = params[:ids].to_s.split("-").map(&:to_i)
|
theme_ids = params[:ids].to_s.split("-").map(&:to_i)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_view'
|
require_dependency 'topic_view'
|
||||||
require_dependency 'promotion'
|
require_dependency 'promotion'
|
||||||
require_dependency 'url_helper'
|
require_dependency 'url_helper'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "mini_mime"
|
require "mini_mime"
|
||||||
require_dependency 'upload_creator'
|
require_dependency 'upload_creator'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserActionsController < ApplicationController
|
class UserActionsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserApiKeysController < ApplicationController
|
class UserApiKeysController < ApplicationController
|
||||||
|
|
||||||
layout 'no_ember'
|
layout 'no_ember'
|
||||||
|
@ -91,7 +93,7 @@ class UserApiKeysController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:auth_redirect]
|
if params[:auth_redirect]
|
||||||
redirect_path = "#{params[:auth_redirect]}?payload=#{CGI.escape(@payload)}"
|
redirect_path = +"#{params[:auth_redirect]}?payload=#{CGI.escape(@payload)}"
|
||||||
redirect_path << "&oneTimePassword=#{CGI.escape(otp_payload)}" if scopes.include?("one_time_password")
|
redirect_path << "&oneTimePassword=#{CGI.escape(otp_payload)}" if scopes.include?("one_time_password")
|
||||||
redirect_to(redirect_path)
|
redirect_to(redirect_path)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'letter_avatar'
|
require_dependency 'letter_avatar'
|
||||||
|
|
||||||
class UserAvatarsController < ApplicationController
|
class UserAvatarsController < ApplicationController
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserBadgesController < ApplicationController
|
class UserBadgesController < ApplicationController
|
||||||
before_action :ensure_badges_enabled
|
before_action :ensure_badges_enabled
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email'
|
require_dependency 'email'
|
||||||
require_dependency 'enum'
|
require_dependency 'enum'
|
||||||
require_dependency 'user_name_suggester'
|
require_dependency 'user_name_suggester'
|
||||||
|
@ -58,7 +60,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if parsed && (parsed.host == nil || parsed.host == Discourse.current_hostname)
|
if parsed && (parsed.host == nil || parsed.host == Discourse.current_hostname)
|
||||||
@origin = "#{parsed.path}"
|
@origin = +"#{parsed.path}"
|
||||||
@origin << "?#{parsed.query}" if parsed.query
|
@origin << "?#{parsed.query}" if parsed.query
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse_hub'
|
require_dependency 'discourse_hub'
|
||||||
require_dependency 'user_name_suggester'
|
require_dependency 'user_name_suggester'
|
||||||
require_dependency 'rate_limiter'
|
require_dependency 'rate_limiter'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
require_dependency 'rate_limiter'
|
||||||
require_dependency 'email_validator'
|
require_dependency 'email_validator'
|
||||||
require_dependency 'email_updater'
|
require_dependency 'email_updater'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "openssl"
|
require "openssl"
|
||||||
|
|
||||||
class WebhooksController < ActionController::Base
|
class WebhooksController < ActionController::Base
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'wizard'
|
require_dependency 'wizard'
|
||||||
require_dependency 'wizard/builder'
|
require_dependency 'wizard/builder'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module CommonHelper
|
module CommonHelper
|
||||||
def render_google_universal_analytics_code
|
def render_google_universal_analytics_code
|
||||||
if Rails.env.production? && SiteSetting.ga_universal_tracking_code.present?
|
if Rails.env.production? && SiteSetting.ga_universal_tracking_code.present?
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module EmailHelper
|
module EmailHelper
|
||||||
|
|
||||||
def mailing_list_topic(topic, post_count)
|
def mailing_list_topic(topic, post_count)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module EmbedHelper
|
module EmbedHelper
|
||||||
|
|
||||||
def embed_post_date(dt)
|
def embed_post_date(dt)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ListHelper
|
module ListHelper
|
||||||
def page_links(topic)
|
def page_links(topic)
|
||||||
posts = topic.posts_count
|
posts = topic.posts_count
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TopicsHelper
|
module TopicsHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module UserNotificationsHelper
|
module UserNotificationsHelper
|
||||||
include GlobalPath
|
include GlobalPath
|
||||||
|
|
||||||
def indent(text, by = 2)
|
def indent(text, by = 2)
|
||||||
spacer = " " * by
|
spacer = " " * by
|
||||||
result = ""
|
result = +""
|
||||||
text.each_line do |line|
|
text.each_line do |line|
|
||||||
result << spacer << line
|
result << spacer << line
|
||||||
end
|
end
|
||||||
|
@ -32,7 +34,7 @@ module UserNotificationsHelper
|
||||||
def first_paragraphs_from(html)
|
def first_paragraphs_from(html)
|
||||||
doc = Nokogiri::HTML(html)
|
doc = Nokogiri::HTML(html)
|
||||||
|
|
||||||
result = ""
|
result = +""
|
||||||
length = 0
|
length = 0
|
||||||
|
|
||||||
doc.css('body > p, aside.onebox, body > ul, body > blockquote').each do |node|
|
doc.css('body > p, aside.onebox, body > ul, body > blockquote').each do |node|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
def self.queued
|
def self.queued
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Skippable
|
module Skippable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Jobs::Onceoff < Jobs::Base
|
class Jobs::Onceoff < Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CleanUpSidekiqStatistic < Jobs::Onceoff
|
class CleanUpSidekiqStatistic < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class ClearWidthAndHeight < Jobs::Onceoff
|
class ClearWidthAndHeight < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CorrectMissingDualstackUrls < Jobs::Onceoff
|
class CorrectMissingDualstackUrls < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CreateTagsSearchIndex < Jobs::Onceoff
|
class CreateTagsSearchIndex < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixFeaturedLinkForTopics < Jobs::Onceoff
|
class FixFeaturedLinkForTopics < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixInvalidGravatarUploads < Jobs::Onceoff
|
class FixInvalidGravatarUploads < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency "upload_fixer"
|
require_dependency "upload_fixer"
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixOutOfSyncUserUploadedAvatar < Jobs::Onceoff
|
class FixOutOfSyncUserUploadedAvatar < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixPostsRead < Jobs::Onceoff
|
class FixPostsRead < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'user_destroyer'
|
require_dependency 'user_destroyer'
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'jobs/scheduled/grant_anniversary_badges'
|
require_dependency 'jobs/scheduled/grant_anniversary_badges'
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixS3Etags < Jobs::Onceoff
|
class FixS3Etags < Jobs::Onceoff
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue