Browse Source

Do not send restart events to browser on import.

Martin Edenhofer 8 years ago
parent
commit
c24b4031fc
2 changed files with 8 additions and 4 deletions
  1. 6 2
      app/models/object_manager/attribute.rb
  2. 2 2
      lib/import/zendesk.rb

+ 6 - 2
app/models/object_manager/attribute.rb

@@ -473,9 +473,13 @@ returns
 
   [record1, record2, ...]
 
+to send no browser reload event, pass false
+
+  ObjectManager::Attribute.migration_execute(false)
+
 =end
 
-  def self.migration_execute
+  def self.migration_execute(send_event = true)
 
     # check if field already exists
     execute_count = 0
@@ -592,7 +596,7 @@ returns
     }
 
     # sent maintenance message to clients
-    if execute_count != 0
+    if send_event && execute_count != 0
       if ENV['APP_RESTART_CMD']
         AppVersion.set(true, 'restart_auto')
         sleep 4

+ 2 - 2
lib/import/zendesk.rb

@@ -456,7 +456,7 @@ module Import::Zendesk
       created_by_id:     1,
       updated_by_id:     1,
     )
-    ObjectManager::Attribute.migration_execute
+    ObjectManager::Attribute.migration_execute(false)
   end
 
   # OAuth
@@ -1001,7 +1001,7 @@ module Import::Zendesk
   # https://developer.zendesk.com/rest_api/docs/core/automations
   def import_automations
 
-    @client.automations.all! { |zendesk_automation|
+    @client.automations.all! { |_zendesk_automation|
 
       # "url"        => "https://example.zendesk.com/api/v2/automations/60037892.json"
       # "id"         => 60037892