From 524e152b24613780c017a80ea04d79ea9954b995 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 21 Jan 2016 11:19:08 +0800 Subject: [PATCH] =?UTF-8?q?Issue=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=88=B0=E4=BA=86=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 10 ++++++++++ app/views/mailer/issue_due_date.html.erb | 10 ++++++++++ config/locales/mailers/zh.yml | 4 +++- lib/tasks/issue_due_date.rake | 4 ++-- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 app/views/mailer/issue_due_date.html.erb diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 318de2942..81c568133 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -379,6 +379,16 @@ class Mailer < ActionMailer::Base end + # issue截止时间提醒 + def issue_due_date(issue, recipients) + @author = issue.author.login + @issue_name = issue.subject + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) + @subject = "#{l(:mail_issue)}#{issue.name} #{l(:mail_issue_due_date)} " + mail :to => recipients, + :subject => @subject + end + # Builds a Mail::Message object used to email recipients of the added issue. # # Example: diff --git a/app/views/mailer/issue_due_date.html.erb b/app/views/mailer/issue_due_date.html.erb new file mode 100644 index 000000000..a4fd81236 --- /dev/null +++ b/app/views/mailer/issue_due_date.html.erb @@ -0,0 +1,10 @@ +
+ +
+
\ No newline at end of file diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 7b56011b1..00a1bfafd 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -28,4 +28,6 @@ zh: mail_homework: "作业:" mail_anonymous_comment_close: "作业匿评已经关闭,请您关注!" mail_anonymous_comment_open: "作业匿评已经开启,请您关注!" - mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" \ No newline at end of file + mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" + mail_issue_due_date: "问题跟踪截止时间快到了,请您关注!" + mail_issue: "问题跟踪:" \ No newline at end of file diff --git a/lib/tasks/issue_due_date.rake b/lib/tasks/issue_due_date.rake index f40fa290f..8d101ff94 100644 --- a/lib/tasks/issue_due_date.rake +++ b/lib/tasks/issue_due_date.rake @@ -12,8 +12,8 @@ namespace :issue_due_date do recipients << assigner recipients.each do |r| issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) - # 发送邮件通知 - # Mailer.homework_endtime__added(homework_common, s.student_id).deliver + # issue截止时间邮件提醒 + Mailer.issue_due_date(issue, recipients).deliver end end end