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
e6219d2b
Commit
e6219d2b
authored
May 06, 2021
by
Manoj M J
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct the 'blocked' scope in 'Member' class
Correct the 'blocked' scope in 'Member' class Changelog: fixed
parent
a1eb1f4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
14 deletions
+12
-14
app/models/member.rb
app/models/member.rb
+2
-3
changelogs/unreleased/mmj-correct-invitation-spec.yml
changelogs/unreleased/mmj-correct-invitation-spec.yml
+5
-0
spec/models/member_spec.rb
spec/models/member_spec.rb
+5
-11
No files found.
app/models/member.rb
View file @
e6219d2b
...
...
@@ -84,10 +84,9 @@ class Member < ApplicationRecord
is_external_invite
=
arel_table
[
:user_id
].
eq
(
nil
).
and
(
arel_table
[
:invite_token
].
not_eq
(
nil
))
user_is_blocked
=
User
.
arel_table
[
:state
].
eq
(
:blocked
)
user_ok
=
Arel
::
Nodes
::
Grouping
.
new
(
is_external_invite
).
or
(
user_is_blocked
)
left_join_users
.
where
(
user_ok
)
.
where
(
user_is_blocked
)
.
where
.
not
(
is_external_invite
)
.
non_request
.
non_minimal_access
.
reorder
(
nil
)
...
...
changelogs/unreleased/mmj-correct-invitation-spec.yml
0 → 100644
View file @
e6219d2b
---
title
:
Correct the 'blocked' scope in 'Member' class
merge_request
:
61108
author
:
type
:
fixed
spec/models/member_spec.rb
View file @
e6219d2b
...
...
@@ -143,16 +143,10 @@ RSpec.describe Member do
@blocked_maintainer
=
project
.
members
.
find_by
(
user_id:
@blocked_maintainer_user
.
id
,
access_level:
Gitlab
::
Access
::
MAINTAINER
)
@blocked_developer
=
project
.
members
.
find_by
(
user_id:
@blocked_developer_user
.
id
,
access_level:
Gitlab
::
Access
::
DEVELOPER
)
@invited_member
=
create
(
:project_member
,
:developer
,
project:
project
,
invite_token:
'1234'
,
invite_email:
'toto1@example.com'
)
@invited_member
=
create
(
:project_member
,
:invited
,
:developer
,
project:
project
)
accepted_invite_user
=
build
(
:user
,
state: :active
)
@accepted_invite_member
=
create
(
:project_member
,
:developer
,
project:
project
,
invite_token:
'1234'
,
invite_email:
'toto2@example.com'
)
@accepted_invite_member
=
create
(
:project_member
,
:invited
,
:developer
,
project:
project
)
.
tap
{
|
u
|
u
.
accept_invite!
(
accepted_invite_user
)
}
requested_user
=
create
(
:user
).
tap
{
|
u
|
project
.
request_access
(
u
)
}
...
...
@@ -325,12 +319,12 @@ RSpec.describe Member do
describe
'.search_invite_email'
do
it
'returns only members the matching e-mail'
do
create
(
:group_member
,
:invited
)
invited_member
=
create
(
:group_member
,
:invited
,
invite_email:
'invited@example.com'
)
invited
=
described_class
.
search_invite_email
(
@
invited_member
.
invite_email
)
invited
=
described_class
.
search_invite_email
(
invited_member
.
invite_email
)
expect
(
invited
.
count
).
to
eq
(
1
)
expect
(
invited
.
first
).
to
eq
(
@
invited_member
)
expect
(
invited
.
first
).
to
eq
(
invited_member
)
expect
(
described_class
.
search_invite_email
(
'bad-email@example.com'
).
count
).
to
eq
(
0
)
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