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
Léo-Paul Géneau
gitlab-ce
Commits
621b08d8
Commit
621b08d8
authored
Nov 18, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sort functionality on project/group members to return invited users
parent
06f696dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
app/models/member.rb
app/models/member.rb
+15
-4
No files found.
app/models/member.rb
View file @
621b08d8
...
...
@@ -57,10 +57,10 @@ class Member < ActiveRecord::Base
scope
:owners
,
->
{
active
.
where
(
access_level:
OWNER
)
}
scope
:owners_and_masters
,
->
{
active
.
where
(
access_level:
[
OWNER
,
MASTER
])
}
scope
:order_name_asc
,
->
{
joins
(
:user
).
merge
(
User
.
order_name_asc
)
}
scope
:order_name_desc
,
->
{
joins
(
:user
).
merge
(
User
.
order_name_desc
)
}
scope
:order_recent_sign_in
,
->
{
joins
(
:user
).
merge
(
User
.
order_recent_sign_in
)
}
scope
:order_oldest_sign_in
,
->
{
joins
(
:user
).
merge
(
User
.
order_oldest_sign_in
)
}
scope
:order_name_asc
,
->
{
left_join_users
.
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
'users.name'
,
'ASC'
)
)
}
scope
:order_name_desc
,
->
{
left_join_users
.
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
'users.name'
,
'DESC'
)
)
}
scope
:order_recent_sign_in
,
->
{
left_join_users
.
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
'users.last_sign_in_at'
,
'DESC'
)
)
}
scope
:order_oldest_sign_in
,
->
{
left_join_users
.
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
'users.last_sign_in_at'
,
'ASC'
)
)
}
before_validation
:generate_invite_token
,
on: :create
,
if:
->
(
member
)
{
member
.
invite_email
.
present?
}
...
...
@@ -94,6 +94,17 @@ class Member < ActiveRecord::Base
end
end
def
left_join_users
users
=
User
.
arel_table
members
=
Member
.
arel_table
member_users
=
members
.
join
(
users
,
Arel
::
Nodes
::
OuterJoin
).
on
(
members
[
:user_id
].
eq
(
users
[
:id
])).
join_sources
joins
(
member_users
)
end
def
access_for_user_ids
(
user_ids
)
where
(
user_id:
user_ids
).
has_access
.
pluck
(
:user_id
,
:access_level
).
to_h
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