修复:部分用户无法收到消息
This commit is contained in:
parent
5216e61479
commit
bc862f8d98
|
@ -35,11 +35,7 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
operator = User.find_by_id(operator_id)
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
return unless operator.present? && issue.present?
|
||||
if args[2].present?
|
||||
receivers = User.where(id: args[2]).where.not(id: operator&.id)
|
||||
else
|
||||
receivers = User.where(id: issue&.assigned_to_id).where.not(id: operator&.id)
|
||||
end
|
||||
receivers = issue&.assigners.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueAssigned.get_message_content(receivers, operator, issue)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, issue_id: issue.id})
|
||||
receivers.find_each do |receiver|
|
||||
|
@ -60,7 +56,7 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
operator = User.find_by_id(operator_id)
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
return unless operator.present? && issue.present?
|
||||
receivers = User.where(id: [issue&.assigned_to_id, issue&.author_id]).where.not(id: operator&.id)
|
||||
receivers = User.where(id: issue.assigners.pluck(:id).append(issue&.author_id)).where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueChanged.get_message_content(receivers, operator, issue, change_params.symbolize_keys)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, issue_id: issue.id, change_params: change_params.symbolize_keys})
|
||||
receivers.find_each do |receiver|
|
||||
|
@ -71,7 +67,7 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
issue_id = args[0]
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
return unless issue.present?
|
||||
receivers = User.where(id: [issue&.assigned_to_id, issue&.author_id])
|
||||
receivers = User.where(id: issue.assigners.pluck(:id).append(issue&.author_id))
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueExpire.get_message_content(receivers, issue)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {issue_id: issue.id})
|
||||
receivers.find_each do |receiver|
|
||||
|
|
|
@ -209,16 +209,16 @@ class MessageTemplate::IssueChanged < MessageTemplate
|
|||
change_count = change_params.keys.size
|
||||
# 疑修负责人修改
|
||||
if change_params[:assigned_to_id].present?
|
||||
assigner1 = User.find_by_id(change_params[:assigned_to_id][0])
|
||||
assigner2 = User.find_by_id(change_params[:assigned_to_id][1])
|
||||
assigner1 = User.where(id: change_params[:assigned_to_id][0])
|
||||
assigner2 = User.where(id: change_params[:assigned_to_id][1])
|
||||
if change_count > 1
|
||||
content.sub!('{ifassigner}', '<br/>')
|
||||
else
|
||||
content.sub!('{ifassigner}', '')
|
||||
end
|
||||
content.sub!('{endassigner}', '')
|
||||
content.gsub!('{assigner1}', assigner1.present? ? assigner1&.real_name : '未指派成员')
|
||||
content.gsub!('{assigner2}', assigner2.present? ? assigner2&.real_name : '未指派成员')
|
||||
content.gsub!('{assigner1}', assigner1.present? ? assigner1.map{|a| a&.real_name}.join("、") : '无')
|
||||
content.gsub!('{assigner2}', assigner2.present? ? assigner2.map{|a| a&.real_name}.join("、") : '无')
|
||||
else
|
||||
content.gsub!(/({ifassigner})(.*)({endassigner})/, '')
|
||||
end
|
||||
|
|
|
@ -55,7 +55,10 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
build_assigner_participants unless assigner_ids.nil? # 负责人
|
||||
build_edit_participants
|
||||
build_atme_participants if @atme_receivers.present?
|
||||
@updated_issue.assigners = @assigners || User.none unless assigner_ids.nil?
|
||||
unless assigner_ids.nil?
|
||||
@previous_issue_changes.merge!(assigned_to_id: [@updated_issue.assigners.pluck(:id), @assigners.pluck(:id)])
|
||||
@updated_issue.assigners = @assigners || User.none
|
||||
end
|
||||
@updated_issue.attachments = @attachments || Attachment.none unless attachment_ids.nil?
|
||||
@updated_issue.issue_tags_relates.destroy_all & @updated_issue.issue_tags = @issue_tags || IssueTag.none unless issue_tag_ids.nil?
|
||||
@updated_issue.issue_tags_value = @issue_tags.order("id asc").pluck(:id).join(",") unless issue_tag_ids.nil?
|
||||
|
@ -118,12 +121,12 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
end
|
||||
|
||||
def build_previous_issue_changes
|
||||
@previous_issue_changes = @updated_issue.previous_changes.except("updated_on", "created_on")
|
||||
if @updated_issue.previous_changes["start_date"].present?
|
||||
@previous_issue_changes.merge!(start_date: [@updated_issue.previous_changes["start_date"][0].to_s, @updated_issue.previous_changes["start_date"][1].to_s])
|
||||
@previous_issue_changes.merge!(@updated_issue.previous_changes.slice("status_id", "priority_id", "fixed_version_id", "issue_tags_value", "branch_name").symbolize_keys)
|
||||
if @updated_issue.previous_changes[:start_date].present?
|
||||
@previous_issue_changes.merge!(start_date: [@updated_issue.previous_changes[:start_date][0].to_s, @updated_issue.previous_changes[:start_date][1].to_s])
|
||||
end
|
||||
if @updated_issue.previous_changes["due_date"].present?
|
||||
@previous_issue_changes.merge!(due_date: [@updated_issue.previous_changes["due_date"][0].to_s, @updated_issue.previous_changes["due_date"][1].to_s])
|
||||
if @updated_issue.previous_changes[:due_date].present?
|
||||
@previous_issue_changes.merge!(due_date: [@updated_issue.previous_changes[:due_date][0].to_s, @updated_issue.previous_changes[:due_date][1].to_s])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue