Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
DEV: rubocop
Dieser Commit ist enthalten in:
Ursprung
c394656ed8
Commit
399cc9c220
1 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1]
|
class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
reversible do |dir|
|
reversible do |dir|
|
||||||
|
@ -16,8 +17,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1]
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if log_json.key?('message') && log_json['message'].is_a?(String)
|
||||||
if log_json.key?('message') and log_json['message'].is_a? String
|
|
||||||
|
|
||||||
attr_strs = []
|
attr_strs = []
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1]
|
||||||
|
|
||||||
attr_strs.each do |attr_str|
|
attr_strs.each do |attr_str|
|
||||||
if attr_str.is_a? String
|
if attr_str.is_a? String
|
||||||
attr_str.gsub!(/[;]/ ,"")
|
attr_str.gsub!(/[;]/ , "")
|
||||||
key, value = attr_str.split(': ')
|
key, value = attr_str.split(': ')
|
||||||
value.strip! if value
|
value.strip! if value
|
||||||
log_json[key] = value ? value : ''
|
log_json[key] = value ? value : ''
|
||||||
|
@ -58,7 +58,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1]
|
||||||
# concatenate wizard/action/user to start of message
|
# concatenate wizard/action/user to start of message
|
||||||
prefixes = log_json.extract!('wizard', 'action', 'user')
|
prefixes = log_json.extract!('wizard', 'action', 'user')
|
||||||
|
|
||||||
message_prefix = prefixes.map{|k,v| "#{k}: #{v}"}.join('; ')
|
message_prefix = prefixes.map { |k, v| "#{k}: #{v}" }.join('; ')
|
||||||
|
|
||||||
if log_json.key?('message')
|
if log_json.key?('message')
|
||||||
log_json['message'] = "#{message_prefix}; #{log_json['message']}"
|
log_json['message'] = "#{message_prefix}; #{log_json['message']}"
|
||||||
|
|
Laden …
In neuem Issue referenzieren