Browse Source

Applied rubocop.

Martin Edenhofer 8 years ago
parent
commit
30fe8aef36

+ 5 - 5
app/controllers/application_controller.rb

@@ -119,7 +119,7 @@ class ApplicationController < ActionController::Base
       content_encoding: request.headers['Content-Encoding'],
       source: request.headers['User-Agent'] || request.headers['Server'],
     }
-    request.headers.each {|key, value|
+    request.headers.each { |key, value|
       next if key[0, 5] != 'HTTP_'
       request_data[:content] += if key == 'HTTP_COOKIE'
                                   "#{key}: xxxxx\n"
@@ -141,7 +141,7 @@ class ApplicationController < ActionController::Base
       content_encoding: nil,
       source: nil,
     }
-    response.headers.each {|key, value|
+    response.headers.each { |key, value|
       response_data[:content] += "#{key}: #{value}\n"
     }
     body = response.body
@@ -473,7 +473,7 @@ class ApplicationController < ActionController::Base
 
     if params[:expand]
       list = []
-      generic_objects.each {|generic_object|
+      generic_objects.each { |generic_object|
         list.push generic_object.attributes_with_relation_names
       }
       render json: list, status: :ok
@@ -483,7 +483,7 @@ class ApplicationController < ActionController::Base
     if params[:full]
       assets = {}
       item_ids = []
-      generic_objects.each {|item|
+      generic_objects.each { |item|
         item_ids.push item.id
         assets = item.assets(assets)
       }
@@ -495,7 +495,7 @@ class ApplicationController < ActionController::Base
     end
 
     generic_objects_with_associations = []
-    generic_objects.each {|item|
+    generic_objects.each { |item|
       generic_objects_with_associations.push item.attributes_with_associations
     }
     model_index_render_result(generic_objects_with_associations)

+ 1 - 1
app/controllers/calendars_controller.rb

@@ -9,7 +9,7 @@ class CalendarsController < ApplicationController
     # calendars
     assets = {}
     calendar_ids = []
-    Calendar.all.order(:name, :created_at).each {|calendar|
+    Calendar.all.order(:name, :created_at).each { |calendar|
       calendar_ids.push calendar.id
       assets = calendar.assets(assets)
     }

+ 9 - 9
app/controllers/channels_controller.rb

@@ -47,11 +47,11 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
 
   def twitter_index
     assets = {}
-    ExternalCredential.where(name: 'twitter').each {|external_credential|
+    ExternalCredential.where(name: 'twitter').each { |external_credential|
       assets = external_credential.assets(assets)
     }
     channel_ids = []
-    Channel.order(:id).each {|channel|
+    Channel.order(:id).each { |channel|
       next if channel.area != 'Twitter::Account'
       assets = channel.assets(assets)
       channel_ids.push channel.id
@@ -70,11 +70,11 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
 
   def facebook_index
     assets = {}
-    ExternalCredential.where(name: 'facebook').each {|external_credential|
+    ExternalCredential.where(name: 'facebook').each { |external_credential|
       assets = external_credential.assets(assets)
     }
     channel_ids = []
-    Channel.order(:id).each {|channel|
+    Channel.order(:id).each { |channel|
       next if channel.area != 'Facebook::Account'
       assets = channel.assets(assets)
       channel_ids.push channel.id
@@ -100,10 +100,10 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
     not_used_email_address_ids = []
     accounts_fixed = []
     assets = {}
-    Channel.order(:id).each {|channel|
+    Channel.order(:id).each { |channel|
       if system_online_service && channel.preferences && channel.preferences['online_service_disable']
         email_addresses = EmailAddress.where(channel_id: channel.id)
-        email_addresses.each {|email_address|
+        email_addresses.each { |email_address|
           accounts_fixed.push email_address
         }
         next
@@ -116,7 +116,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
         assets = channel.assets(assets)
       end
     }
-    EmailAddress.all.each {|email_address|
+    EmailAddress.all.each { |email_address|
       next if system_online_service && email_address.preferences && email_address.preferences['online_service_disable']
       email_address_ids.push email_address.id
       assets = email_address.assets(assets)
@@ -299,7 +299,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
     # save settings
     if result[:result] == 'ok'
 
-      Channel.where(area: 'Email::Notification').each {|channel|
+      Channel.where(area: 'Email::Notification').each { |channel|
         active = false
         if adapter =~ /^#{channel.options[:outbound][:adapter]}$/i
           active = true
@@ -322,7 +322,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
   private
 
   def email_account_duplicate?(result, channel_id = nil)
-    Channel.where(area: 'Email::Account').each {|channel|
+    Channel.where(area: 'Email::Account').each { |channel|
       next if !channel.options
       next if !channel.options[:inbound]
       next if !channel.options[:inbound][:adapter]

+ 1 - 1
app/controllers/chats_controller.rb

@@ -7,7 +7,7 @@ class ChatsController < ApplicationController
     deny_if_not_role(Z_ROLENAME_ADMIN)
     chat_ids = []
     assets = {}
-    Chat.order(:id).each {|chat|
+    Chat.order(:id).each { |chat|
       chat_ids.push chat.id
       assets = chat.assets(assets)
     }

+ 2 - 2
app/controllers/first_steps_controller.rb

@@ -246,9 +246,9 @@ class FirstStepsController < ApplicationController
       test_ticket_active = false
     end
     return result if test_ticket_active
-    result.each {|item|
+    result.each { |item|
       items = []
-      item[:items].each {|local_item|
+      item[:items].each { |local_item|
         next if local_item[:name] == 'Create a Test Ticket'
         items.push local_item
       }

+ 1 - 1
app/controllers/getting_started_controller.rb

@@ -179,7 +179,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
     end
 
     # set changed settings
-    settings.each {|key, value|
+    settings.each { |key, value|
       Setting.set(key, value)
     }
 

+ 1 - 1
app/controllers/import_otrs_controller.rb

@@ -26,7 +26,7 @@ class ImportOtrsController < ApplicationController
 
     if !response.success? && response.code.to_s !~ /^40.$/
       message_human = ''
-      translation_map.each {|key, message|
+      translation_map.each { |key, message|
         if response.error.to_s =~ /#{Regexp.escape(key)}/i
           message_human = message
         end

+ 1 - 1
app/controllers/import_zendesk_controller.rb

@@ -27,7 +27,7 @@ class ImportZendeskController < ApplicationController
 
     if !response.success?
       message_human = ''
-      translation_map.each {|key, message|
+      translation_map.each { |key, message|
         if response.error.to_s =~ /#{Regexp.escape(key)}/i
           message_human = message
         end

+ 3 - 3
app/controllers/integration/sipgate_controller.rb

@@ -16,7 +16,7 @@ class Integration::SipgateController < ApplicationController
       block_caller_ids = config_inbound[:block_caller_ids] || []
 
       # check if call need to be blocked
-      block_caller_ids.each {|item|
+      block_caller_ids.each { |item|
         next unless item[:caller_id] == params['from']
         xml = Builder::XmlMarkup.new(indent: 2)
         xml.instruct!
@@ -61,7 +61,7 @@ class Integration::SipgateController < ApplicationController
     to      = params[:to]
     from    = nil
     if to
-      config_outbound.each {|row|
+      config_outbound.each { |row|
         dest = row[:dest].gsub(/\*/, '.+?')
         next if to !~ /^#{dest}$/
         from = row[:caller_id]
@@ -173,7 +173,7 @@ class Integration::SipgateController < ApplicationController
     preferences_maybe = {}
     preferences_maybe[direction] = []
     caller_ids = Cti::CallerId.lookup(params[direction])
-    caller_ids.each {|record|
+    caller_ids.each { |record|
       if record.level == 'known'
         preferences_known[direction].push record
       else

+ 3 - 3
app/controllers/organizations_controller.rb

@@ -67,7 +67,7 @@ curl http://localhost/api/v1/organizations -v -u #{login}:#{password}
 
     if params[:expand]
       list = []
-      organizations.each {|organization|
+      organizations.each { |organization|
         list.push organization.attributes_with_relation_names
       }
       render json: list, status: :ok
@@ -77,7 +77,7 @@ curl http://localhost/api/v1/organizations -v -u #{login}:#{password}
     if params[:full]
       assets = {}
       item_ids = []
-      organizations.each {|item|
+      organizations.each { |item|
         item_ids.push item.id
         assets = item.assets(assets)
       }
@@ -246,7 +246,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
 
     if params[:expand]
       list = []
-      organization_all.each {|organization|
+      organization_all.each { |organization|
         list.push organization.attributes_with_relation_names
       }
       render json: list, status: :ok

Some files were not shown because too many files changed in this diff