[Multiple issue assignees] Resolving conflicts

This commit is contained in:
Valery Sizov 2017-05-04 18:52:01 +03:00
parent 4b1d580a84
commit 0f2a9681a3
3 changed files with 3 additions and 18 deletions

View file

@ -7,23 +7,7 @@ class IssueAssignee < ActiveRecord::Base
after_create :update_assignee_cache_counts after_create :update_assignee_cache_counts
after_destroy :update_assignee_cache_counts after_destroy :update_assignee_cache_counts
# EE-specific
after_create :update_elasticsearch_index
after_destroy :update_elasticsearch_index
# EE-specific
def update_assignee_cache_counts def update_assignee_cache_counts
assignee&.update_cache_counts assignee&.update_cache_counts
end end
def update_elasticsearch_index
if current_application_settings.elasticsearch_indexing?
ElasticIndexerWorker.perform_async(
:update,
'Issue',
issue.id,
changed_fields: ['assignee_ids']
)
end
end
end end

View file

@ -89,7 +89,6 @@ class User < ActiveRecord::Base
has_many :subscriptions, dependent: :destroy has_many :subscriptions, dependent: :destroy
has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event" has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy
has_one :abuse_report, dependent: :destroy, foreign_key: :user_id has_one :abuse_report, dependent: :destroy, foreign_key: :user_id
has_many :reported_abuse_reports, dependent: :destroy, foreign_key: :reporter_id, class_name: "AbuseReport" has_many :reported_abuse_reports, dependent: :destroy, foreign_key: :reporter_id, class_name: "AbuseReport"
has_many :spam_logs, dependent: :destroy has_many :spam_logs, dependent: :destroy

View file

@ -74,12 +74,14 @@ class NotificationService
previous_assignee: previous_assignees previous_assignee: previous_assignees
) )
previous_assignee_ids = previous_assignees.map(&:id)
recipients.each do |recipient| recipients.each do |recipient|
mailer.send( mailer.send(
:reassigned_issue_email, :reassigned_issue_email,
recipient.id, recipient.id,
issue.id, issue.id,
previous_assignees.map(&:id), previous_assignee_ids,
current_user.id current_user.id
).deliver_later ).deliver_later
end end