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
09726bdf
Commit
09726bdf
authored
Sep 12, 2017
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small cleanup changes based on feedback
parent
30e3a49e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
18 deletions
+15
-18
app/models/user.rb
app/models/user.rb
+9
-5
app/views/devise/mailer/confirmation_instructions.html.haml
app/views/devise/mailer/confirmation_instructions.html.haml
+1
-4
app/views/devise/mailer/confirmation_instructions.text.erb
app/views/devise/mailer/confirmation_instructions.text.erb
+1
-5
config/routes/user.rb
config/routes/user.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+3
-3
No files found.
app/models/user.rb
View file @
09726bdf
...
...
@@ -810,6 +810,10 @@ class User < ActiveRecord::Base
avatar_path
(
args
)
||
GravatarService
.
new
.
execute
(
email
,
size
,
scale
,
username:
username
)
end
def
primary_email_verified?
confirmed?
&&
!
temp_oauth_email?
end
def
all_emails
all_emails
=
[]
all_emails
<<
email
unless
temp_oauth_email?
...
...
@@ -817,15 +821,15 @@ class User < ActiveRecord::Base
all_emails
end
def
all_
verified_emails
def
verified_emails
verified_emails
=
[]
verified_emails
<<
email
if
confirmed?
&&
!
temp_oauth_email
?
verified_emails
.
concat
(
emails
.
select
{
|
e
|
e
.
confirmed?
}.
map
(
&
:email
))
verified_emails
<<
email
if
primary_email_verified
?
verified_emails
.
concat
(
emails
.
where
.
not
(
confirmed_at:
nil
).
pluck
(
:email
))
verified_emails
end
def
verified_email?
(
email
)
all_verified_emails
.
include?
(
email
)
def
verified_email?
(
check_
email
)
(
email
==
check_email
&&
primary_email_verified?
)
||
verified_emails
.
include?
(
check_
email
)
end
def
hook_attrs
...
...
app/views/devise/mailer/confirmation_instructions.html.haml
View file @
09726bdf
-
if
@resource
.
is_a?
(
User
)
=
render
partial:
'confirmation_instructions_account'
-
else
=
render
partial:
'confirmation_instructions_secondary'
=
render
partial:
"confirmation_instructions_
#{
@resource
.
is_a?
(
User
)
?
'account'
:
'secondary'
}
"
\ No newline at end of file
app/views/devise/mailer/confirmation_instructions.text.erb
View file @
09726bdf
<%
if
@resource
.
is_a?
(
User
)
%>
<%=
render
partial:
'confirmation_instructions_account'
%>
<%
else
%>
<%=
render
partial:
'confirmation_instructions_secondary'
%>
<%
end
%>
<%=
render
partial:
"confirmation_instructions_
#{
@resource
.
is_a?
(
User
)
?
'account'
:
'secondary'
}
"
%>
\ No newline at end of file
config/routes/user.rb
View file @
09726bdf
spec/models/user_spec.rb
View file @
09726bdf
...
...
@@ -1100,18 +1100,18 @@ describe User do
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_unconfirmed
=
create
:email
,
user:
user
user
.
reload
expect
(
user
.
all_emails
).
to
eq
([
user
.
email
,
email_unconfirmed
.
email
,
email_confirmed
.
email
])
expect
(
user
.
all_emails
).
to
match_array
([
user
.
email
,
email_unconfirmed
.
email
,
email_confirmed
.
email
])
end
end
describe
'#
all_
verified_emails'
do
describe
'#verified_emails'
do
let
(
:user
)
{
create
(
:user
)
}
it
'returns only confirmed emails'
do
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_unconfirmed
=
create
:email
,
user:
user
user
.
reload
expect
(
user
.
all_verified_emails
).
to
eq
([
user
.
email
,
email_confirmed
.
email
])
expect
(
user
.
verified_emails
).
to
match_array
([
user
.
email
,
email_confirmed
.
email
])
end
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