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
ce1b79af
Commit
ce1b79af
authored
Oct 03, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL Fixes
parent
8b76e306
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+1
-1
app/models/group.rb
app/models/group.rb
+5
-1
app/models/project.rb
app/models/project.rb
+3
-3
No files found.
app/controllers/groups_controller.rb
View file @
ce1b79af
...
@@ -50,7 +50,7 @@ class GroupsController < ApplicationController
...
@@ -50,7 +50,7 @@ class GroupsController < ApplicationController
end
end
def
people
def
people
@users
=
group
.
projects
.
map
(
&
:users
).
flatten
.
uniq
@users
=
group
.
users
end
end
protected
protected
...
...
app/models/group.rb
View file @
ce1b79af
...
@@ -23,10 +23,14 @@ class Group < ActiveRecord::Base
...
@@ -23,10 +23,14 @@ class Group < ActiveRecord::Base
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
def
self
.
search
query
def
self
.
search
query
where
(
"name like :query
or
code like :query"
,
query:
"%
#{
query
}
%"
)
where
(
"name like :query
OR
code like :query"
,
query:
"%
#{
query
}
%"
)
end
end
def
to_param
def
to_param
code
code
end
end
def
users
User
.
joins
(
:users_projects
).
where
(
'users_projects.project_id'
=>
project_ids
).
uniq
end
end
end
app/models/project.rb
View file @
ce1b79af
...
@@ -30,15 +30,15 @@ class Project < ActiveRecord::Base
...
@@ -30,15 +30,15 @@ class Project < ActiveRecord::Base
# Scopes
# Scopes
scope
:public_only
,
where
(
private_flag:
false
)
scope
:public_only
,
where
(
private_flag:
false
)
scope
:without_user
,
->
(
user
)
{
where
(
"id not in
(:ids)"
,
ids:
user
.
projects
.
map
(
&
:id
)
)
}
scope
:without_user
,
->
(
user
)
{
where
(
"id NOT IN
(:ids)"
,
ids:
user
.
projects
.
map
(
&
:id
)
)
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"id
not in
(:ids)"
,
ids:
group
.
project_ids
)
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"id
NOT IN
(:ids)"
,
ids:
group
.
project_ids
)
}
def
self
.
active
def
self
.
active
joins
(
:issues
,
:notes
,
:merge_requests
).
order
(
"issues.created_at, notes.created_at, merge_requests.created_at DESC"
)
joins
(
:issues
,
:notes
,
:merge_requests
).
order
(
"issues.created_at, notes.created_at, merge_requests.created_at DESC"
)
end
end
def
self
.
search
query
def
self
.
search
query
where
(
"name like :query
or code like :query or
path like :query"
,
query:
"%
#{
query
}
%"
)
where
(
"name like :query
OR code like :query OR
path like :query"
,
query:
"%
#{
query
}
%"
)
end
end
def
self
.
create_by_user
(
params
,
user
)
def
self
.
create_by_user
(
params
,
user
)
...
...
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