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
Jérome Perrin
gitlab-ce
Commits
9bb35e7e
Commit
9bb35e7e
authored
Mar 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent app crash if team owner removed
parent
3a09f02e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
15 deletions
+41
-15
app/models/user.rb
app/models/user.rb
+35
-12
app/views/admin/groups/index.html.haml
app/views/admin/groups/index.html.haml
+1
-1
app/views/admin/teams/index.html.haml
app/views/admin/teams/index.html.haml
+5
-2
No files found.
app/models/user.rb
View file @
9bb35e7e
...
...
@@ -46,10 +46,35 @@ class User < ActiveRecord::Base
attr_accessor
:force_random_password
#
# Relations
#
# Namespace for personal projects
has_one
:namespace
,
dependent: :destroy
,
foreign_key: :owner_id
,
class_name:
"Namespace"
,
conditions:
'type IS NULL'
has_one
:namespace
,
dependent: :destroy
,
foreign_key: :owner_id
,
class_name:
"Namespace"
,
conditions:
'type IS NULL'
# Profile
has_many
:keys
,
dependent: :destroy
# Groups
has_many
:groups
,
class_name:
"Group"
,
foreign_key: :owner_id
# Teams
has_many
:own_teams
,
class_name:
"UserTeam"
,
foreign_key: :owner_id
,
dependent: :destroy
has_many
:user_team_user_relationships
,
dependent: :destroy
has_many
:user_teams
,
through: :user_team_user_relationships
has_many
:user_team_project_relationships
,
through: :user_teams
has_many
:team_projects
,
through: :user_team_project_relationships
has_many
:keys
,
dependent: :destroy
# Projects
has_many
:users_projects
,
dependent: :destroy
has_many
:issues
,
dependent: :destroy
,
foreign_key: :author_id
has_many
:notes
,
dependent: :destroy
,
foreign_key: :author_id
...
...
@@ -57,18 +82,16 @@ class User < ActiveRecord::Base
has_many
:events
,
dependent: :destroy
,
foreign_key: :author_id
,
class_name:
"Event"
has_many
:assigned_issues
,
dependent: :destroy
,
foreign_key: :assignee_id
,
class_name:
"Issue"
has_many
:assigned_merge_requests
,
dependent: :destroy
,
foreign_key: :assignee_id
,
class_name:
"MergeRequest"
has_many
:projects
,
through: :users_projects
has_many
:groups
,
class_name:
"Group"
,
foreign_key: :owner_id
has_many
:recent_events
,
class_name:
"Event"
,
foreign_key: :author_id
,
order:
"id DESC"
has_many
:projects
,
through: :users_projects
has_many
:user_team_user_relationships
,
dependent: :destroy
has_many
:user_teams
,
through: :user_team_user_relationships
has_many
:user_team_project_relationships
,
through: :user_teams
has_many
:team_projects
,
through: :user_team_project_relationships
has_many
:recent_events
,
class_name:
"Event"
,
foreign_key: :author_id
,
order:
"id DESC"
#
# Validations
#
validates
:name
,
presence:
true
validates
:email
,
presence:
true
,
format:
{
with:
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/
}
validates
:bio
,
length:
{
within:
0
..
255
}
...
...
app/views/admin/groups/index.html.haml
View file @
9bb35e7e
...
...
@@ -26,7 +26,7 @@
%tr
%td
%strong
=
link_to
group
.
name
,
[
:admin
,
group
]
%td
=
group
.
description
%td
=
truncate
group
.
description
%td
=
group
.
path
%td
=
group
.
projects
.
count
%td
...
...
app/views/admin/teams/index.html.haml
View file @
9bb35e7e
...
...
@@ -27,12 +27,15 @@
%tr
%td
%strong
=
link_to
team
.
name
,
admin_team_path
(
team
)
%td
=
team
.
description
%td
=
t
runcate
t
eam
.
description
%td
=
team
.
path
%td
=
team
.
projects
.
count
%td
=
team
.
members
.
count
%td
=
link_to
team
.
owner
.
name
,
admin_user_path
(
team
.
owner
)
-
if
team
.
owner
=
link_to
team
.
owner
.
name
,
admin_user_path
(
team
.
owner
)
-
else
(deleted)
%td
.bgred
=
link_to
'Edit'
,
edit_admin_team_path
(
team
),
id:
"edit_
#{
dom_id
(
team
)
}
"
,
class:
"btn btn-small"
=
link_to
'Destroy'
,
admin_team_path
(
team
),
confirm:
"REMOVE
#{
team
.
name
}
? Are you sure?"
,
method: :delete
,
class:
"btn btn-small btn-remove"
...
...
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