forked from Gitlink/forgeplus
add: expire issue send message
This commit is contained in:
parent
cb76a946ef
commit
b8a52107a5
|
@ -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
|
|
@ -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]
|
||||
|
|
|
@ -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', '易修')
|
||||
|
|
|
@ -8,3 +8,4 @@
|
|||
- [notify, 100]
|
||||
- [mailers, 101]
|
||||
- [cache, 10]
|
||||
- [message, 20]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue