add: expire issue send message

This commit is contained in:
yystopf 2021-09-16 10:10:05 +08:00
parent cb76a946ef
commit b8a52107a5
5 changed files with 20 additions and 3 deletions

View File

@ -0,0 +1,11 @@
class DelayExpiredIssueJob < ApplicationJob
queue_as :message
def perform
Issue.where(due_date: Date.today + 1.days).find_each do |issue|
SendTemplateMessageJob.perform_later('IssueAssignerExpire', issue.id)
SendTemplateMessageJob.perform_later('IssueCreatorExpire', issue.id)
end
end
end

View File

@ -1,5 +1,5 @@
class SendTemplateMessageJob < ApplicationJob
queue_as :default
queue_as :message
def perform(source, *args)
Rails.logger.info "SendTemplateMessageJob [args] #{args}"
@ -94,7 +94,7 @@ class SendTemplateMessageJob < ApplicationJob
project = Project.find_by_id(project_id)
return unless user.present? && project.present?
receivers = User.where(id: user.id)
receivers_string, content, notification_url = MessageTemplate::ProjectJoined.get_message_content(receivers, project)
receivers_string, content, notification_url = MessageTemplate::ProjectLeft.get_message_content(receivers, project)
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user.id, project_id: project.id})
when 'ProjectRole'
user_id, project_id, role = args[0], args[1], args[2]

View File

@ -64,7 +64,7 @@ class MessageTemplate::ProjectSettingChanged < MessageTemplate
content.gsub!(/({ifpermission})(.*)({endpermission})/, '')
end
# 项目导航更改
if change_params[:navbar].present? || navbar_is_changed_by_time
if change_params[:navbar].present?
navbar = project.project_units.order(unit_type: :asc).pluck(:unit_type).join('')
navbar.gsub!('code', '')
navbar.gsub!('issues', '易修')

View File

@ -8,3 +8,4 @@
- [notify, 100]
- [mailers, 101]
- [cache, 10]
- [message, 20]

View File

@ -2,3 +2,8 @@ sync_gitea_repo_update_time:
cron: "0 0 * * *"
class: "SyncRepoUpdateTimeJob"
queue: default
delay_expired_issue:
cron: "0 0 * * *"
class: "DelayExpiredIssueJob"
queue: message