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
19d628dd
Commit
19d628dd
authored
Jun 22, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set default order to authorized_project and authorized_groups
parent
c2317d67
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/project.rb
app/models/project.rb
+1
-1
app/models/user.rb
app/models/user.rb
+2
-2
No files found.
app/models/project.rb
View file @
19d628dd
...
@@ -100,7 +100,7 @@ class Project < ActiveRecord::Base
...
@@ -100,7 +100,7 @@ class Project < ActiveRecord::Base
scope
:in_team
,
->
(
team
)
{
where
(
"projects.id IN (:ids)"
,
ids:
team
.
projects
.
map
(
&
:id
))
}
scope
:in_team
,
->
(
team
)
{
where
(
"projects.id IN (:ids)"
,
ids:
team
.
projects
.
map
(
&
:id
))
}
scope
:in_namespace
,
->
(
namespace
)
{
where
(
namespace_id:
namespace
.
id
)
}
scope
:in_namespace
,
->
(
namespace
)
{
where
(
namespace_id:
namespace
.
id
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:sorted_by_activity
,
->
{
order
(
"projects.last_activity_at DESC"
)
}
scope
:sorted_by_activity
,
->
{
re
order
(
"projects.last_activity_at DESC"
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:public_only
,
->
{
where
(
public:
true
)
}
scope
:public_only
,
->
{
where
(
public:
true
)
}
...
...
app/models/user.rb
View file @
19d628dd
...
@@ -231,7 +231,7 @@ class User < ActiveRecord::Base
...
@@ -231,7 +231,7 @@ class User < ActiveRecord::Base
def
authorized_groups
def
authorized_groups
@authorized_groups
||=
begin
@authorized_groups
||=
begin
group_ids
=
(
groups
.
pluck
(
:id
)
+
own_groups
.
pluck
(
:id
)
+
authorized_projects
.
pluck
(
:namespace_id
))
group_ids
=
(
groups
.
pluck
(
:id
)
+
own_groups
.
pluck
(
:id
)
+
authorized_projects
.
pluck
(
:namespace_id
))
Group
.
where
(
id:
group_ids
)
Group
.
where
(
id:
group_ids
)
.
order
(
'namespaces.name ASC'
)
end
end
end
end
...
@@ -240,7 +240,7 @@ class User < ActiveRecord::Base
...
@@ -240,7 +240,7 @@ class User < ActiveRecord::Base
def
authorized_projects
def
authorized_projects
@authorized_projects
||=
begin
@authorized_projects
||=
begin
project_ids
=
(
owned_projects
.
pluck
(
:id
)
+
groups_projects
.
pluck
(
:id
)
+
projects
.
pluck
(
:id
)).
uniq
project_ids
=
(
owned_projects
.
pluck
(
:id
)
+
groups_projects
.
pluck
(
:id
)
+
projects
.
pluck
(
:id
)).
uniq
Project
.
where
(
id:
project_ids
).
includes
(
:namespace
)
Project
.
where
(
id:
project_ids
).
joins
(
:namespace
).
order
(
'namespaces.name ASC'
)
end
end
end
end
...
...
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