修复:issue 评论中@无参与记录

This commit is contained in:
yystopf 2023-02-28 16:57:44 +08:00
parent 4091872091
commit ec44376e4d
3 changed files with 7 additions and 5 deletions

View File

@ -60,7 +60,7 @@ class Api::V1::Issues::CreateService < ApplicationService
project.del_project_issue_cache_delete_count # 把缓存里存储项目删除issue的个数清除掉 project.del_project_issue_cache_delete_count # 把缓存里存储项目删除issue的个数清除掉
# @信息发送 # @信息发送
AtmeService.call(current_user, @atme_receivers, @issue) unless receivers_login.blank? AtmeService.call(current_user, @atme_receivers, @created_issue) unless receivers_login.blank?
# 发消息 # 发消息
if Site.has_notice_menu? if Site.has_notice_menu?

View File

@ -4,7 +4,7 @@ class Api::V1::Issues::Journals::CreateService < ApplicationService
include Api::V1::Issues::Concerns::Loadable include Api::V1::Issues::Concerns::Loadable
attr_reader :issue, :current_user, :notes, :parent_id, :reply_id, :attachment_ids, :receivers_login attr_reader :issue, :current_user, :notes, :parent_id, :reply_id, :attachment_ids, :receivers_login
attr_accessor :created_journal attr_accessor :created_journal, :atme_receivers
validates :notes, :issue, :current_user, presence: true validates :notes, :issue, :current_user, presence: true
@ -39,7 +39,7 @@ class Api::V1::Issues::Journals::CreateService < ApplicationService
@created_journal.save! @created_journal.save!
# @信息发送 # @信息发送
AtmeService.call(current_user, @atme_receivers, @issue) unless receivers_login.blank? AtmeService.call(current_user, @atme_receivers, @created_journal) unless receivers_login.blank?
unlock("Api::V1::Issues::Journals::CreateService:#{@issue.id}") unlock("Api::V1::Issues::Journals::CreateService:#{@issue.id}")
@ -67,6 +67,7 @@ class Api::V1::Issues::Journals::CreateService < ApplicationService
def build_atme_participants def build_atme_participants
@atme_receivers.each do |receiver| @atme_receivers.each do |receiver|
next if @issue.issue_participants.exists?(participant_type: "atme", participant_id: receiver.id)
@issue.issue_participants.new({participant_type: "atme", participant_id: receiver.id}) @issue.issue_participants.new({participant_type: "atme", participant_id: receiver.id})
end end
end end

View File

@ -4,7 +4,7 @@ class Api::V1::Issues::Journals::UpdateService < ApplicationService
include Api::V1::Issues::Concerns::Loadable include Api::V1::Issues::Concerns::Loadable
attr_reader :issue, :journal, :current_user, :notes, :attachment_ids, :receivers_login attr_reader :issue, :journal, :current_user, :notes, :attachment_ids, :receivers_login
attr_accessor :updated_journal attr_accessor :updated_journal, :atme_receivers
validates :notes, :issue, :journal, :current_user, presence: true validates :notes, :issue, :journal, :current_user, presence: true
@ -36,7 +36,7 @@ class Api::V1::Issues::Journals::UpdateService < ApplicationService
@updated_journal.save! @updated_journal.save!
# @信息发送 # @信息发送
AtmeService.call(current_user, @atme_receivers, @issue) unless receivers_login.blank? AtmeService.call(current_user, @atme_receivers, @created_journal) unless receivers_login.blank?
unlock("Api::V1::Issues::Journals::UpdateService:#{@issue.id}:#{@journal.id}") unlock("Api::V1::Issues::Journals::UpdateService:#{@issue.id}:#{@journal.id}")
@ -48,6 +48,7 @@ class Api::V1::Issues::Journals::UpdateService < ApplicationService
def build_atme_participants def build_atme_participants
@atme_receivers.each do |receiver| @atme_receivers.each do |receiver|
next if @issue.issue_participants.exists?(participant_type: "atme", participant_id: receiver.id)
@issue.issue_participants.new({participant_type: "atme", participant_id: receiver.id}) @issue.issue_participants.new({participant_type: "atme", participant_id: receiver.id})
end end
end end