forked from Gitlink/forgeplus
修复:消息内容修复
This commit is contained in:
parent
bc862f8d98
commit
b5383bfa5a
|
@ -9,8 +9,11 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
||||||
@total_issues_count = @object_result[:total_issues_count]
|
@total_issues_count = @object_result[:total_issues_count]
|
||||||
@opened_issues_count = @object_result[:opened_issues_count]
|
@opened_issues_count = @object_result[:opened_issues_count]
|
||||||
@closed_issues_count = @object_result[:closed_issues_count]
|
@closed_issues_count = @object_result[:closed_issues_count]
|
||||||
|
if params[:only_name].present?
|
||||||
@issues = kaminari_paginate(@object_result[:data])
|
@issues = kaminary_select_paginate(@object_result[:data].pluck(:id, :subject))
|
||||||
|
else
|
||||||
|
@issues = kaminari_paginate(@object_result[:data])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -31,16 +31,16 @@ class MessageTemplate::IssueChanged < MessageTemplate
|
||||||
change_count = change_params.keys.size
|
change_count = change_params.keys.size
|
||||||
# 疑修负责人修改
|
# 疑修负责人修改
|
||||||
if change_params[:assigned_to_id].present?
|
if change_params[:assigned_to_id].present?
|
||||||
assigner1 = User.find_by_id(change_params[:assigned_to_id][0])
|
assigner1 = User.where(id: change_params[:assigned_to_id][0])
|
||||||
assigner2 = User.find_by_id(change_params[:assigned_to_id][1])
|
assigner2 = User.where(id: change_params[:assigned_to_id][1])
|
||||||
if change_count > 1
|
if change_count > 1
|
||||||
content.sub!('{ifassigner}', '<br/>')
|
content.sub!('{ifassigner}', '<br/>')
|
||||||
else
|
else
|
||||||
content.sub!('{ifassigner}', '')
|
content.sub!('{ifassigner}', '')
|
||||||
end
|
end
|
||||||
content.sub!('{endassigner}', '')
|
content.sub!('{endassigner}', '')
|
||||||
content.gsub!('{assigner1}', assigner1.present? ? assigner1&.real_name : '未指派成员')
|
content.gsub!('{assigner1}', assigner1.present? ? assigner1.map{|a| a&.real_name}.join("、") : '未指派成员')
|
||||||
content.gsub!('{assigner2}', assigner2.present? ? assigner2&.real_name : '未指派成员')
|
content.gsub!('{assigner2}', assigner2.present? ? assigner2.map{|a| a&.real_name}.join("、") : '未指派成员')
|
||||||
else
|
else
|
||||||
content.gsub!(/({ifassigner})(.*)({endassigner})/, '')
|
content.gsub!(/({ifassigner})(.*)({endassigner})/, '')
|
||||||
end
|
end
|
||||||
|
@ -217,8 +217,8 @@ class MessageTemplate::IssueChanged < MessageTemplate
|
||||||
content.sub!('{ifassigner}', '')
|
content.sub!('{ifassigner}', '')
|
||||||
end
|
end
|
||||||
content.sub!('{endassigner}', '')
|
content.sub!('{endassigner}', '')
|
||||||
content.gsub!('{assigner1}', assigner1.present? ? assigner1.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("、") : '无')
|
content.gsub!('{assigner2}', assigner2.present? ? assigner2.map{|a| a&.real_name}.join("、") : '未指派成员')
|
||||||
else
|
else
|
||||||
content.gsub!(/({ifassigner})(.*)({endassigner})/, '')
|
content.gsub!(/({ifassigner})(.*)({endassigner})/, '')
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,5 +4,9 @@ json.closed_count @closed_issues_count
|
||||||
json.total_count @issues.total_count
|
json.total_count @issues.total_count
|
||||||
json.has_created_issues @project.issues.size > 0
|
json.has_created_issues @project.issues.size > 0
|
||||||
json.issues @issues.each do |issue|
|
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
|
end
|
Loading…
Reference in New Issue