Browse Source

Fixes #4725 - New Facebook posts are not caught if multiple pages are configured, a lot of old posts are handled before.

Rolf Schmidt 1 year ago
parent
commit
1135118ab5
2 changed files with 5 additions and 4 deletions
  1. 2 1
      app/jobs/communicate_facebook_job.rb
  2. 3 3
      app/models/channel/driver/facebook.rb

+ 2 - 1
app/jobs/communicate_facebook_job.rb

@@ -17,7 +17,8 @@ class CommunicateFacebookJob < ApplicationJob
     log_error(article, "Can't find ticket.preferences for Ticket.find(#{article.ticket_id})") if !ticket.preferences
     log_error(article, "Can't find ticket.preferences['channel_id'] for Ticket.find(#{article.ticket_id})") if !ticket.preferences['channel_id']
     channel = Channel.lookup(id: ticket.preferences['channel_id'])
-    log_error(article, "Channel.find(#{channel.id}) isn't a twitter channel!") if !channel.options[:adapter].match?(%r{\Afacebook}i)
+    log_error(article, "Channel.find(#{ticket.preferences['channel_id']}) does not exist anymore!") if channel.blank?
+    log_error(article, "Channel.find(#{channel.id}) isn't a facebook channel!") if !channel.options[:adapter].match?(%r{\Afacebook}i)
 
     # check source object id
     if !ticket.preferences['channel_fb_object_id']

+ 3 - 3
app/models/channel/driver/facebook.rb

@@ -90,10 +90,10 @@ returns
     return if !@sync
     return if !@sync['pages']
 
-    older_import = 0
-    older_import_max = 12
-
     @sync['pages'].each do |page_to_sync_id, page_to_sync_params|
+      older_import = 0
+      older_import_max = 12
+
       page = get_page(page_to_sync_id)
       next if !page
       next if page_to_sync_params['group_id'].blank?