mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 11:42:14 +08:00
DEV: Enable unless
cops
We discussed the use of `unless` internally and decided to enforce available rules from rubocop to restrict its most problematic uses.
This commit is contained in:

committed by
Loïc Guitaut

parent
87de3c2319
commit
f7c57fbc19
@ -9,13 +9,10 @@ module PrettyText
|
||||
# functions here are available to v8
|
||||
def t(key, opts)
|
||||
key = "js." + key
|
||||
unless opts
|
||||
I18n.t(key)
|
||||
else
|
||||
str = I18n.t(key, Hash[opts.entries].symbolize_keys).dup
|
||||
opts.each { |k, v| str.gsub!("{{#{k.to_s}}}", v.to_s) }
|
||||
str
|
||||
end
|
||||
return I18n.t(key) if opts.blank?
|
||||
str = I18n.t(key, Hash[opts.entries].symbolize_keys).dup
|
||||
opts.each { |k, v| str.gsub!("{{#{k.to_s}}}", v.to_s) }
|
||||
str
|
||||
end
|
||||
|
||||
def avatar_template(username)
|
||||
|
Reference in New Issue
Block a user