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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
96105e21
Commit
96105e21
authored
Nov 23, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update namespace if user changed username. Dont move project if new record
parent
5ca17723
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
app/observers/project_observer.rb
app/observers/project_observer.rb
+1
-1
app/observers/user_observer.rb
app/observers/user_observer.rb
+6
-0
No files found.
app/observers/project_observer.rb
View file @
96105e21
class
ProjectObserver
<
ActiveRecord
::
Observer
def
before_save
(
project
)
# Move repository if namespace changed
if
project
.
namespace_id_changed?
if
project
.
namespace_id_changed?
and
not
project
.
new_record?
move_project
(
project
)
end
end
...
...
app/observers/user_observer.rb
View file @
96105e21
...
...
@@ -9,6 +9,12 @@ class UserObserver < ActiveRecord::Observer
log_info
(
"User
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
) was removed"
)
end
def
after_save
user
if
user
.
username_changed?
user
.
namespace
.
update_attributes
(
code:
user
.
username
)
end
end
protected
def
log_info
message
...
...
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