Followup improvement for issue#1394 - Reindex elastic search not possible because of <null>/Twitter::NullObject.
This commit is contained in:
parent
4094bd1d51
commit
b96c57210a
1 changed files with 3 additions and 3 deletions
|
@ -1,12 +1,12 @@
|
|||
class FixedTwitterTicketArticlePreferences4 < ActiveRecord::Migration
|
||||
class FixedTwitterTicketArticlePreferences4 < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
# find article preferences with Twitter::NullObject and replace it with nill to prevent elasticsearch index issue
|
||||
article_type = Ticket::Article::Type.find_by(name: ['twitter status', 'twitter direct-message'])
|
||||
article_ids = Ticket::Article.where(type_id: article_type.id).pluck(:id)
|
||||
article_type_ids = Ticket::Article::Type.where(name: ['twitter status', 'twitter direct-message']).pluck(:id)
|
||||
article_ids = Ticket::Article.where(type_id: article_type_ids).pluck(:id)
|
||||
article_ids.each { |article_id|
|
||||
article = Ticket::Article.find(article_id)
|
||||
next if !article.preferences
|
||||
|
|
Loading…
Reference in a new issue