Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
9222c26e
Commit
9222c26e
authored
5 years ago
by
ThibG
Committed by
Eugen Rochko
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix “invited by” not showing up for invited accounts in admin interface (#10791)
parent
94439a1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/user.rb
+5
-1
app/models/user.rb
app/validators/blacklisted_email_validator.rb
+1
-1
app/validators/blacklisted_email_validator.rb
spec/validators/blacklisted_email_validator_spec.rb
+1
-1
spec/validators/blacklisted_email_validator_spec.rb
with
7 additions
and
3 deletions
+7
-3
app/models/user.rb
+
5
-
1
View file @
9222c26e
...
...
@@ -114,6 +114,10 @@ class User < ApplicationRecord
end
def
invited?
invite_id
.
present?
end
def
valid_invitation?
invite_id
.
present?
&&
invite
.
valid_for_use?
end
...
...
@@ -274,7 +278,7 @@ class User < ApplicationRecord
private
def
set_approved
self
.
approved
=
open_registrations?
||
invited
?
||
external?
self
.
approved
=
open_registrations?
||
valid_invitation
?
||
external?
end
def
open_registrations?
...
...
This diff is collapsed.
Click to expand it.
app/validators/blacklisted_email_validator.rb
+
1
-
1
View file @
9222c26e
...
...
@@ -2,7 +2,7 @@
class
BlacklistedEmailValidator
<
ActiveModel
::
Validator
def
validate
(
user
)
return
if
user
.
invited
?
return
if
user
.
valid_invitation
?
@email
=
user
.
email
...
...
This diff is collapsed.
Click to expand it.
spec/validators/blacklisted_email_validator_spec.rb
+
1
-
1
View file @
9222c26e
...
...
@@ -8,7 +8,7 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do
let
(
:errors
)
{
double
(
add:
nil
)
}
before
do
allow
(
user
).
to
receive
(
:
invited
?
)
{
false
}
allow
(
user
).
to
receive
(
:
valid_invitation
?
)
{
false
}
allow_any_instance_of
(
described_class
).
to
receive
(
:blocked_email?
)
{
blocked_email
}
described_class
.
new
.
validate
(
user
)
end
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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