mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Merge pull request #2180 from tomciopp/master
More idiomatic approach to finding drafts
This commit is contained in:
commit
d71f62a9f9
11 changed files with 31 additions and 30 deletions
|
@ -96,13 +96,13 @@ module JsLocaleHelper
|
|||
end
|
||||
|
||||
def self.strip_out_message_formats!(hash, prefix = "", rval = {})
|
||||
if Hash === hash
|
||||
hash.each do |k,v|
|
||||
if Hash === v
|
||||
rval.merge!(strip_out_message_formats!(v, prefix + (prefix.length > 0 ? "." : "") << k, rval))
|
||||
elsif k.to_s().end_with?("_MF")
|
||||
rval[prefix + (prefix.length > 0 ? "." : "") << k] = v
|
||||
hash.delete(k)
|
||||
if hash.is_a?(Hash)
|
||||
hash.each do |key, value|
|
||||
if value.is_a?(Hash)
|
||||
rval.merge!(strip_out_message_formats!(value, prefix + (prefix.length > 0 ? "." : "") << key, rval))
|
||||
elsif key.to_s.end_with?("_MF")
|
||||
rval[prefix + (prefix.length > 0 ? "." : "") << key] = value
|
||||
hash.delete(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue