mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #547 from kid0m4n/convert-ruby-1-9-syntax
Convert a lot of :a => b to a: b and bring peace to the world
This commit is contained in:
@@ -14,7 +14,7 @@ module CanonicalURL
|
||||
def canonical_link_tag(url = nil)
|
||||
|
||||
return '' unless url || @canonical_url
|
||||
tag('link', :rel => 'canonical', :href => url || @canonical_url || request.url)
|
||||
tag('link', rel: 'canonical', href: url || @canonical_url || request.url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ module CurrentUser
|
||||
end
|
||||
|
||||
def set_permanent_cookie!(user)
|
||||
cookies.permanent["_t"] = { :value => user.auth_token, :httponly => true }
|
||||
cookies.permanent["_t"] = { value: user.auth_token, httponly: true }
|
||||
end
|
||||
|
||||
def current_user
|
||||
|
||||
@@ -5,7 +5,7 @@ class DiscourseRedis
|
||||
|
||||
def initialize
|
||||
@config = YAML.load(ERB.new(File.new("#{Rails.root}/config/redis.yml").read).result)[Rails.env]
|
||||
redis_opts = {:host => @config['host'], :port => @config['port'], :db => @config['db']}
|
||||
redis_opts = {host: @config['host'], port: @config['port'], db: @config['db']}
|
||||
redis_opts[:password] = @config['password'] if @config['password']
|
||||
@redis = Redis.new(redis_opts)
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ module Jobs
|
||||
dbs.each do |db|
|
||||
begin
|
||||
Jobs::Base.mutex.synchronize do
|
||||
RailsMultisite::ConnectionManagement.establish_connection(:db => db)
|
||||
RailsMultisite::ConnectionManagement.establish_connection(db: db)
|
||||
I18n.locale = SiteSetting.default_locale
|
||||
execute(opts)
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ module Jobs
|
||||
|
||||
class Exporter < Jobs::Base
|
||||
|
||||
sidekiq_options :retry => false
|
||||
sidekiq_options retry: false
|
||||
|
||||
def execute(args)
|
||||
raise Import::ImportInProgressError if Import::is_import_running?
|
||||
|
||||
@@ -10,7 +10,7 @@ module Jobs
|
||||
|
||||
class Importer < Jobs::Base
|
||||
|
||||
sidekiq_options :retry => false
|
||||
sidekiq_options retry: false
|
||||
|
||||
BACKUP_SCHEMA = 'backup'
|
||||
|
||||
@@ -286,4 +286,4 @@ module Jobs
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ class PostCreator
|
||||
if @opts[:archetype] == Archetype.private_message
|
||||
|
||||
usernames = @opts[:target_usernames].split(',')
|
||||
User.where(:username => usernames).each do |u|
|
||||
User.where(username: usernames).each do |u|
|
||||
|
||||
unless guardian.can_send_private_message?(u)
|
||||
topic.errors.add(:archetype, :cant_send_pm)
|
||||
|
||||
@@ -5,14 +5,14 @@ module PrettyText
|
||||
|
||||
def self.whitelist
|
||||
{
|
||||
:elements => %w[
|
||||
elements: %w[
|
||||
a abbr aside b bdo blockquote br caption cite code col colgroup dd div del dfn dl
|
||||
dt em hr figcaption figure h1 h2 h3 h4 h5 h6 hgroup i img ins kbd li mark
|
||||
ol p pre q rp rt ruby s samp small span strike strong sub sup table tbody td
|
||||
tfoot th thead time tr u ul var wbr
|
||||
],
|
||||
|
||||
:attributes => {
|
||||
attributes: {
|
||||
:all => ['dir', 'lang', 'title', 'class'],
|
||||
'aside' => ['data-post', 'data-full', 'data-topic'],
|
||||
'a' => ['href'],
|
||||
@@ -32,7 +32,7 @@ module PrettyText
|
||||
'ul' => ['type']
|
||||
},
|
||||
|
||||
:protocols => {
|
||||
protocols: {
|
||||
'a' => {'href' => ['ftp', 'http', 'https', 'mailto', :relative]},
|
||||
'blockquote' => {'cite' => ['http', 'https', :relative]},
|
||||
'del' => {'cite' => ['http', 'https', :relative]},
|
||||
|
||||
@@ -133,13 +133,13 @@ module SiteSettingExtension
|
||||
|
||||
def remove_override!(name)
|
||||
return unless table_exists?
|
||||
SiteSetting.where(:name => name).destroy_all
|
||||
SiteSetting.where(name: name).destroy_all
|
||||
end
|
||||
|
||||
def add_override!(name,val)
|
||||
return unless table_exists?
|
||||
|
||||
setting = SiteSetting.where(:name => name).first
|
||||
setting = SiteSetting.where(name: name).first
|
||||
type = get_data_type(defaults[name])
|
||||
|
||||
if type == types[:bool] && val != true && val != false
|
||||
@@ -159,7 +159,7 @@ module SiteSettingExtension
|
||||
setting.data_type = type
|
||||
setting.save
|
||||
else
|
||||
SiteSetting.create!(:name => name, :value => val, :data_type => type)
|
||||
SiteSetting.create!(name: name, value: val, data_type: type)
|
||||
end
|
||||
|
||||
MessageBus.publish('/site_settings', {process: process_id})
|
||||
|
||||
@@ -196,7 +196,7 @@ class TopicQuery
|
||||
end
|
||||
end
|
||||
|
||||
result = result.listable_topics.includes(:category => :topic_only_relative_url)
|
||||
result = result.listable_topics.includes(category: :topic_only_relative_url)
|
||||
result = result.where('categories.name is null or categories.name <> ?', query_opts[:exclude_category]) if query_opts[:exclude_category]
|
||||
result = result.where('categories.name = ?', query_opts[:only_category]) if query_opts[:only_category]
|
||||
result = result.limit(page_size) unless query_opts[:limit] == false
|
||||
|
||||
Reference in New Issue
Block a user