Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
75dd7042
Commit
75dd7042
authored
Dec 20, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send update instructions after project namespace id changed or namespace path changed
parent
d188adfd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
2 deletions
+47
-2
app/mailers/notify.rb
app/mailers/notify.rb
+6
-0
app/models/namespace.rb
app/models/namespace.rb
+8
-1
app/models/project.rb
app/models/project.rb
+6
-0
app/observers/project_observer.rb
app/observers/project_observer.rb
+2
-1
app/views/notify/project_was_moved_email.html.haml
app/views/notify/project_was_moved_email.html.haml
+25
-0
No files found.
app/mailers/notify.rb
View file @
75dd7042
...
...
@@ -102,6 +102,12 @@ class Notify < ActionMailer::Base
end
def
project_was_moved_email
(
user_project_id
)
@users_project
=
UsersProject
.
find
user_project_id
@project
=
@users_project
.
project
mail
(
to:
@users_project
.
user
.
email
,
subject:
subject
(
"project was moved"
))
end
#
# User
...
...
app/models/namespace.rb
View file @
75dd7042
...
...
@@ -59,7 +59,10 @@ class Namespace < ActiveRecord::Base
if
File
.
exists?
(
new_path
)
raise
"Already exists"
end
system
(
"mv
#{
old_path
}
#{
new_path
}
"
)
if
system
(
"mv
#{
old_path
}
#{
new_path
}
"
)
send_update_instructions
end
end
end
...
...
@@ -67,4 +70,8 @@ class Namespace < ActiveRecord::Base
dir_path
=
File
.
join
(
Gitlab
.
config
.
gitolite
.
repos_path
,
path
)
system
(
"rm -rf
#{
dir_path
}
"
)
end
def
send_update_instructions
projects
.
each
(
&
:send_move_instructions
)
end
end
app/models/project.rb
View file @
75dd7042
...
...
@@ -259,4 +259,10 @@ class Project < ActiveRecord::Base
merge_requests
end
end
def
send_move_instructions
self
.
users_projects
.
each
do
|
member
|
Notify
.
project_was_moved_email
(
member
.
id
).
deliver
end
end
end
app/observers/project_observer.rb
View file @
75dd7042
...
...
@@ -3,7 +3,8 @@ class ProjectObserver < ActiveRecord::Observer
project
.
update_repository
end
def
after_save
(
project
)
def
after_update
(
project
)
project
.
send_move_instructions
if
project
.
namespace_id_changed?
end
def
after_destroy
(
project
)
...
...
app/views/notify/project_was_moved_email.html.haml
0 → 100644
View file @
75dd7042
%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: #555; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
width:
"600"
}
%tr
%td
{
width:
"21"
}
%td
%h3
=
"Project was moved in another location"
%td
{
width:
"21"
}
%tr
%td
{
width:
"21"
}
%td
%p
Project is now accessible via next link
=
link_to
project_url
(
@project
)
do
=
@project
.
name_with_namespace
%p
You may want to update your local repository with new remote:
%br
%table
{
border:
"0"
,
cellpadding:
"0"
,
cellspacing:
"0"
,
width:
"558"
}
%tr
%td
{
valign:
"top"
}
%p
{
style:
"background:#f5f5f5; padding:10px; border:1px solid #ddd"
}
git remote set-url origin
#{
@project
.
ssh_url_to_repo
}
%br
%td
{
width:
"21"
}
Write
Preview
Markdown
is supported
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