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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
00d9d767
Commit
00d9d767
authored
Nov 16, 2016
by
Ben Bodenmiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix "Without projects" filter
parent
f27f9803
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
app/models/user.rb
app/models/user.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+22
-0
No files found.
CHANGELOG.md
View file @
00d9d767
...
@@ -73,6 +73,7 @@ entry.
...
@@ -73,6 +73,7 @@ entry.
-
Fix applying GitHub-imported labels when importing job is interrupted
-
Fix applying GitHub-imported labels when importing job is interrupted
-
Allow to search for user by secondary email address in the admin interface(/admin/users) !7115 (YarNayar)
-
Allow to search for user by secondary email address in the admin interface(/admin/users) !7115 (YarNayar)
-
Updated commit SHA styling on the branches page.
-
Updated commit SHA styling on the branches page.
-
Fix "Without projects" filter. !6611 (Ben Bodenmiller)
-
Fix 404 when visit /projects page
-
Fix 404 when visit /projects page
## 8.13.5 (2016-11-08)
## 8.13.5 (2016-11-08)
...
...
app/models/user.rb
View file @
00d9d767
...
@@ -173,7 +173,7 @@ class User < ActiveRecord::Base
...
@@ -173,7 +173,7 @@ class User < ActiveRecord::Base
scope
:external
,
->
{
where
(
external:
true
)
}
scope
:external
,
->
{
where
(
external:
true
)
}
scope
:active
,
->
{
with_state
(
:active
)
}
scope
:active
,
->
{
with_state
(
:active
)
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
all
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
all
}
scope
:without_projects
,
->
{
where
(
'id NOT IN (SELECT DISTINCT(user_id) FROM members)'
)
}
scope
:without_projects
,
->
{
where
(
'id NOT IN (SELECT DISTINCT(user_id) FROM members
WHERE user_id IS NOT NULL AND requested_at IS NULL
)'
)
}
scope
:todo_authors
,
->
(
user_id
,
state
)
{
where
(
id:
Todo
.
where
(
user_id:
user_id
,
state:
state
).
select
(
:author_id
))
}
scope
:todo_authors
,
->
(
user_id
,
state
)
{
where
(
id:
Todo
.
where
(
user_id:
user_id
,
state:
state
).
select
(
:author_id
))
}
def
self
.
with_two_factor
def
self
.
with_two_factor
...
...
spec/models/user_spec.rb
View file @
00d9d767
...
@@ -490,6 +490,28 @@ describe User, models: true do
...
@@ -490,6 +490,28 @@ describe User, models: true do
end
end
end
end
describe
'.without_projects'
do
let!
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user_without_project
)
{
create
(
:user
)
}
let!
(
:user_without_project2
)
{
create
(
:user
)
}
before
do
# add user to project
project
.
team
<<
[
user
,
:master
]
# create invite to projet
create
(
:project_member
,
:developer
,
project:
project
,
invite_token:
'1234'
,
invite_email:
'inviteduser1@example.com'
)
# create request to join project
project
.
request_access
(
user_without_project2
)
end
it
{
expect
(
User
.
without_projects
).
not_to
include
user
}
it
{
expect
(
User
.
without_projects
).
to
include
user_without_project
}
it
{
expect
(
User
.
without_projects
).
to
include
user_without_project2
}
end
describe
'.not_in_project'
do
describe
'.not_in_project'
do
before
do
before
do
User
.
delete_all
User
.
delete_all
...
...
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