Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
de39a7f064fb
Commit
de39a7f0
authored
Sep 29, 2015
by
Valery Sizov
Browse files
Note the original location of a moved project when notifying users of the move
parent
f495f97d82f4
Changes
10
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
de39a7f0
...
...
@@ -18,6 +18,7 @@
- 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
View file @
de39a7f0
...
...
@@ -50,7 +50,7 @@
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
)
...
...
@@ -54,6 +54,7 @@
@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
View file @
de39a7f0
...
...
@@ -137,7 +137,9 @@
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
View file @
de39a7f0
...
...
@@ -481,8 +481,8 @@
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 @@
# 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
View file @
de39a7f0
...
...
@@ -183,8 +183,8 @@
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
|
...
...
@@ -187,8 +187,8 @@
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
View file @
de39a7f0
...
...
@@ -38,7 +38,7 @@
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
View file @
de39a7f0
%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
View file @
de39a7f0
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
View file @
de39a7f0
...
...
@@ -399,7 +399,7 @@
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
View file @
de39a7f0
...
...
@@ -427,7 +427,7 @@
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
)
...
...
@@ -431,7 +431,7 @@
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
)
...
...
@@ -435,7 +435,7 @@
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment