Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
32aa2e3f
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
32aa2e3f
编写于
12月 18, 2011
作者:
V
Valery Sizov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notification when assignee issue changed
上级
df5b192e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
1 deletion
+38
-1
app/mailers/notify.rb
app/mailers/notify.rb
+8
-0
app/models/mailer_observer.rb
app/models/mailer_observer.rb
+13
-0
app/views/notify/changed_issue_email.html.haml
app/views/notify/changed_issue_email.html.haml
+16
-0
app/views/notify/new_issue_email.html.haml
app/views/notify/new_issue_email.html.haml
+1
-1
未找到文件。
app/mailers/notify.rb
浏览文件 @
32aa2e3f
...
...
@@ -53,4 +53,12 @@ class Notify < ActionMailer::Base
@project
=
merge_request
.
project
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@merge_request
.
title
}
"
)
end
def
changed_issue_email
(
user
,
issue
)
@user
=
user
@assignee_was
||=
User
.
find
(
issue
.
assignee_id_was
)
@issue
=
issue
@project
=
issue
.
project
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@issue
.
title
}
"
)
end
end
app/models/mailer_observer.rb
浏览文件 @
32aa2e3f
...
...
@@ -11,6 +11,7 @@ class MailerObserver < ActiveRecord::Observer
def
after_update
(
model
)
changed_merge_request
(
model
)
if
model
.
kind_of?
(
MergeRequest
)
changed_issue
(
model
)
if
model
.
kind_of?
(
Issue
)
end
protected
...
...
@@ -61,4 +62,16 @@ class MailerObserver < ActiveRecord::Observer
end
end
def
changed_issue
(
issue
)
if
issue
.
assignee_id_changed?
recipients_ids
=
[
issue
.
assignee_id_was
]
recipients_ids
<<
issue
.
assignee_id
recipients_ids
.
delete
current_user
.
id
User
.
find
(
recipients_ids
).
each
do
|
user
|
Notify
.
changed_issue_email
(
user
,
issue
).
deliver
end
end
end
end
app/views/notify/changed_issue_email.html.haml
0 → 100644
浏览文件 @
32aa2e3f
%td
.content
{
:align
=>
"left"
,
:style
=>
"font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;"
,
:valign
=>
"top"
,
:width
=>
"600"
}
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:style
=>
"color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
:width
=>
"600"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Reassigned Issue
=
link_to
truncate
(
@issue
.
title
,
:length
=>
16
),
project_issue_url
(
@project
,
@issue
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"padding: 15px 0 15px;"
,
:valign
=>
"top"
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Assignee changed from
#{
@assignee_was
.
name
}
to
#{
@issue
.
assignee
.
name
}
%td
app/views/notify/new_issue_email.html.haml
浏览文件 @
32aa2e3f
...
...
@@ -4,7 +4,7 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Hi
#{
@user
.
name
}
!
New Issue was created and assigned to you.
New Issue was created and assigned to you.
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录