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
bb0cba92
Commit
bb0cba92
authored
Feb 28, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't require ghost users to be blocked
parent
153d3e57
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
23 deletions
+0
-23
app/models/user.rb
app/models/user.rb
+0
-7
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-16
No files found.
app/models/user.rb
View file @
bb0cba92
...
@@ -126,7 +126,6 @@ class User < ActiveRecord::Base
...
@@ -126,7 +126,6 @@ class User < ActiveRecord::Base
validate
:unique_email
,
if:
->
(
user
)
{
user
.
email_changed?
}
validate
:unique_email
,
if:
->
(
user
)
{
user
.
email_changed?
}
validate
:owns_notification_email
,
if:
->
(
user
)
{
user
.
notification_email_changed?
}
validate
:owns_notification_email
,
if:
->
(
user
)
{
user
.
notification_email_changed?
}
validate
:owns_public_email
,
if:
->
(
user
)
{
user
.
public_email_changed?
}
validate
:owns_public_email
,
if:
->
(
user
)
{
user
.
public_email_changed?
}
validate
:ghost_users_must_be_blocked
validates
:avatar
,
file_size:
{
maximum:
200
.
kilobytes
.
to_i
}
validates
:avatar
,
file_size:
{
maximum:
200
.
kilobytes
.
to_i
}
before_validation
:generate_password
,
on: :create
before_validation
:generate_password
,
on: :create
...
@@ -455,12 +454,6 @@ class User < ActiveRecord::Base
...
@@ -455,12 +454,6 @@ class User < ActiveRecord::Base
errors
.
add
(
:public_email
,
"is not an email you own"
)
unless
all_emails
.
include?
(
public_email
)
errors
.
add
(
:public_email
,
"is not an email you own"
)
unless
all_emails
.
include?
(
public_email
)
end
end
def
ghost_users_must_be_blocked
if
ghost?
&&
!
blocked?
errors
.
add
(
:ghost
,
'cannot be enabled for a user who is not blocked.'
)
end
end
def
update_emails_with_primary_email
def
update_emails_with_primary_email
primary_email_record
=
emails
.
find_by
(
email:
email
)
primary_email_record
=
emails
.
find_by
(
email:
email
)
if
primary_email_record
if
primary_email_record
...
...
spec/models/user_spec.rb
View file @
bb0cba92
...
@@ -210,22 +210,6 @@ describe User, models: true do
...
@@ -210,22 +210,6 @@ describe User, models: true do
end
end
end
end
end
end
describe
'ghost users'
do
it
'does not allow a non-blocked ghost user'
do
user
=
build
(
:user
,
:ghost
)
user
.
state
=
'active'
expect
(
user
).
to
be_invalid
end
it
'allows a blocked ghost user'
do
user
=
build
(
:user
,
:ghost
)
user
.
state
=
'blocked'
expect
(
user
).
to
be_valid
end
end
end
end
describe
"scopes"
do
describe
"scopes"
do
...
...
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