Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5b573130
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 搜索 >>
提交
5b573130
编写于
9月 29, 2015
作者:
V
Valery Sizov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Note the original location of a moved project when notifying users of the move
上级
2714d5b8
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
18 addition
and
14 deletion
+18
-14
CHANGELOG
CHANGELOG
+1
-0
app/mailers/emails/projects.rb
app/mailers/emails/projects.rb
+2
-1
app/models/namespace.rb
app/models/namespace.rb
+3
-1
app/models/project.rb
app/models/project.rb
+3
-3
app/services/notification_service.rb
app/services/notification_service.rb
+2
-2
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+1
-1
app/views/notify/project_was_moved_email.html.haml
app/views/notify/project_was_moved_email.html.haml
+1
-1
app/views/notify/project_was_moved_email.text.erb
app/views/notify/project_was_moved_email.text.erb
+1
-1
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+3
-3
未找到文件。
CHANGELOG
浏览文件 @
5b573130
...
...
@@ -18,6 +18,7 @@ v 8.1.0 (unreleased)
- Move CI triggers page to project settings area
- Move CI project settings page to CE project settings area
- Fix bug when removed file was not appearing in merge request diff
- Note the original location of a moved project when notifying users of the move
v 8.0.3
- Fix URL shown in Slack notifications
...
...
app/mailers/emails/projects.rb
浏览文件 @
5b573130
...
...
@@ -50,10 +50,11 @@ module Emails
subject:
subject
(
"Invitation declined"
))
end
def
project_was_moved_email
(
project_id
,
user_id
)
def
project_was_moved_email
(
project_id
,
user_id
,
old_path_with_namespace
)
@current_user
=
@user
=
User
.
find
user_id
@project
=
Project
.
find
project_id
@target_url
=
namespace_project_url
(
@project
.
namespace
,
@project
)
@old_path_with_namespace
=
old_path_with_namespace
mail
(
to:
@user
.
notification_email
,
subject:
subject
(
"Project was moved"
))
end
...
...
app/models/namespace.rb
浏览文件 @
5b573130
...
...
@@ -137,7 +137,9 @@ class Namespace < ActiveRecord::Base
end
def
send_update_instructions
projects
.
each
(
&
:send_move_instructions
)
projects
.
each
do
|
project
|
project
.
send_move_instructions
(
"
#{
path_was
}
/
#{
project
.
path
}
"
)
end
end
def
kind
...
...
app/models/project.rb
浏览文件 @
5b573130
...
...
@@ -481,8 +481,8 @@ class Project < ActiveRecord::Base
end
end
def
send_move_instructions
NotificationService
.
new
.
project_was_moved
(
self
)
def
send_move_instructions
(
old_path_with_namespace
)
NotificationService
.
new
.
project_was_moved
(
self
,
old_path_with_namespace
)
end
def
owner
...
...
@@ -624,7 +624,7 @@ class Project < ActiveRecord::Base
# So we basically we mute exceptions in next actions
begin
gitlab_shell
.
mv_repository
(
"
#{
old_path_with_namespace
}
.wiki"
,
"
#{
new_path_with_namespace
}
.wiki"
)
send_move_instructions
send_move_instructions
(
old_path_with_namespace
)
reset_events_cache
rescue
# Returning false does not rollback after_* transaction but gives
...
...
app/services/notification_service.rb
浏览文件 @
5b573130
...
...
@@ -183,12 +183,12 @@ class NotificationService
mailer
.
group_access_granted_email
(
group_member
.
id
)
end
def
project_was_moved
(
project
)
def
project_was_moved
(
project
,
old_path_with_namespace
)
recipients
=
project
.
team
.
members
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
.
each
do
|
recipient
|
mailer
.
project_was_moved_email
(
project
.
id
,
recipient
.
id
)
mailer
.
project_was_moved_email
(
project
.
id
,
recipient
.
id
,
old_path_with_namespace
)
end
end
...
...
app/services/projects/transfer_service.rb
浏览文件 @
5b573130
...
...
@@ -38,7 +38,7 @@ module Projects
project
.
save!
# Notifications
project
.
send_move_instructions
project
.
send_move_instructions
(
old_path
)
# Move main repository
unless
gitlab_shell
.
mv_repository
(
old_path
,
new_path
)
...
...
app/views/notify/project_was_moved_email.html.haml
浏览文件 @
5b573130
%p
Project was moved to another location
Project
#{
@old_path_with_namespace
}
was moved to another location
%p
The project is now located under
=
link_to
namespace_project_url
(
@project
.
namespace
,
@project
)
do
...
...
app/views/notify/project_was_moved_email.text.erb
浏览文件 @
5b573130
Project was moved to another location
Project
#{@old_path_with_namespace}
was moved to another location
The project is now located under
<%=
namespace_project_url
(
@project
.
namespace
,
@project
)
%>
...
...
spec/mailers/notify_spec.rb
浏览文件 @
5b573130
...
...
@@ -399,7 +399,7 @@ describe Notify do
describe
'project was moved'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
Notify
.
project_was_moved_email
(
project
.
id
,
user
.
id
)
}
subject
{
Notify
.
project_was_moved_email
(
project
.
id
,
user
.
id
,
"gitlab/gitlab"
)
}
it_behaves_like
'an email sent from GitLab'
...
...
spec/services/notification_service_spec.rb
浏览文件 @
5b573130
...
...
@@ -427,15 +427,15 @@ describe NotificationService do
should_email
(
@u_watcher
.
id
)
should_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
project_was_moved
(
project
)
notification
.
project_was_moved
(
project
,
"gitlab/gitlab"
)
end
def
should_email
(
user_id
)
expect
(
Notify
).
to
receive
(
:project_was_moved_email
).
with
(
project
.
id
,
user_id
)
expect
(
Notify
).
to
receive
(
:project_was_moved_email
).
with
(
project
.
id
,
user_id
,
"gitlab/gitlab"
)
end
def
should_not_email
(
user_id
)
expect
(
Notify
).
not_to
receive
(
:project_was_moved_email
).
with
(
project
.
id
,
user_id
)
expect
(
Notify
).
not_to
receive
(
:project_was_moved_email
).
with
(
project
.
id
,
user_id
,
"gitlab/gitlab"
)
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录