修复:消息内容修复

This commit is contained in:
yystopf 2023-03-03 18:43:18 +08:00
parent bc862f8d98
commit b5383bfa5a
3 changed files with 16 additions and 9 deletions

View File

@ -9,8 +9,11 @@ class Api::V1::IssuesController < Api::V1::BaseController
@total_issues_count = @object_result[:total_issues_count]
@opened_issues_count = @object_result[:opened_issues_count]
@closed_issues_count = @object_result[:closed_issues_count]
@issues = kaminari_paginate(@object_result[:data])
if params[:only_name].present?
@issues = kaminary_select_paginate(@object_result[:data].pluck(:id, :subject))
else
@issues = kaminari_paginate(@object_result[:data])
end
end
def create

View File

@ -31,16 +31,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
@ -217,8 +217,8 @@ class MessageTemplate::IssueChanged < MessageTemplate
content.sub!('{ifassigner}', '')
end
content.sub!('{endassigner}', '')
content.gsub!('{assigner1}', assigner1.present? ? assigner1.map{|a| a&.real_name}.join("") : '')
content.gsub!('{assigner2}', assigner2.present? ? assigner2.map{|a| a&.real_name}.join("") : '')
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

View File

@ -4,5 +4,9 @@ json.closed_count @closed_issues_count
json.total_count @issues.total_count
json.has_created_issues @project.issues.size > 0
json.issues @issues.each do |issue|
json.partial! "simple_detail", locals: {issue: issue}
if params[:only_name].present?
json.partial! "simple_detail", locals: {issue: issue}
else
json.(issue, :id, :subject)
end
end