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
82cd20ac
Commit
82cd20ac
authored
Feb 20, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
a7d1db72
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
16 deletions
+35
-16
app/models/user.rb
app/models/user.rb
+6
-2
app/views/profiles/_email_settings.html.haml
app/views/profiles/_email_settings.html.haml
+1
-1
app/views/profiles/notifications/_email_settings.html.haml
app/views/profiles/notifications/_email_settings.html.haml
+1
-1
app/views/profiles/notifications/_group_settings.html.haml
app/views/profiles/notifications/_group_settings.html.haml
+1
-1
changelogs/unreleased/197790-hide-private-commit-emails-in-notification-settings.yml
...0-hide-private-commit-emails-in-notification-settings.yml
+5
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+21
-11
No files found.
app/models/user.rb
View file @
82cd20ac
...
...
@@ -1186,14 +1186,18 @@ class User < ApplicationRecord
Member
.
where
(
invite_email:
verified_emails
).
invite
end
def
all_emails
def
all_emails
(
include_private_email:
true
)
all_emails
=
[]
all_emails
<<
email
unless
temp_oauth_email?
all_emails
<<
private_commit_email
all_emails
<<
private_commit_email
if
include_private_email
all_emails
.
concat
(
emails
.
map
(
&
:email
))
all_emails
end
def
all_public_emails
all_emails
(
include_private_email:
false
)
end
def
verified_emails
verified_emails
=
[]
verified_emails
<<
email
if
primary_email_verified?
...
...
app/views/profiles/_email_settings.html.haml
View file @
82cd20ac
...
...
@@ -5,7 +5,7 @@
-
help_text
=
email_change_disabled
?
s_
(
"Your account uses dedicated credentials for the
\"
%{group_name}
\"
group and can only be updated through SSO."
)
%
{
group_name:
@user
.
managing_group
.
name
}
:
read_only_help_text
=
form
.
text_field
:email
,
required:
true
,
class:
'input-lg'
,
value:
(
@user
.
email
unless
@user
.
temp_oauth_email?
),
help:
help_text
.
html_safe
,
readonly:
readonly
||
email_change_disabled
=
form
.
select
:public_email
,
options_for_select
(
@user
.
all_emails
,
selected:
@user
.
public_email
),
=
form
.
select
:public_email
,
options_for_select
(
@user
.
all_
public_
emails
,
selected:
@user
.
public_email
),
{
help:
s_
(
"Profiles|This email will be displayed on your public profile"
),
include_blank:
s_
(
"Profiles|Do not show on profile"
)
},
control_class:
'select2 input-lg'
,
disabled:
email_change_disabled
-
commit_email_link_url
=
help_page_path
(
'user/profile/index'
,
anchor:
'commit-email'
,
target:
'_blank'
)
...
...
app/views/profiles/notifications/_email_settings.html.haml
View file @
82cd20ac
-
form
=
local_assigns
.
fetch
(
:form
)
.form-group
=
form
.
label
:notification_email
,
class:
"label-bold"
=
form
.
select
:notification_email
,
@user
.
all_emails
,
{
include_blank:
false
},
class:
"select2"
,
disabled:
local_assigns
.
fetch
(
:email_change_disabled
,
nil
)
=
form
.
select
:notification_email
,
@user
.
all_
public_
emails
,
{
include_blank:
false
},
class:
"select2"
,
disabled:
local_assigns
.
fetch
(
:email_change_disabled
,
nil
)
.help-block
=
local_assigns
.
fetch
(
:help_text
,
nil
)
app/views/profiles/notifications/_group_settings.html.haml
View file @
82cd20ac
...
...
@@ -13,4 +13,4 @@
.table-section.section-30
=
form_for
setting
,
url:
profile_notifications_group_path
(
group
),
method: :put
,
html:
{
class:
'update-notifications'
}
do
|
f
|
=
f
.
select
:notification_email
,
@user
.
all_emails
,
{
include_blank:
'Global notification email'
},
class:
'select2 js-group-notification-email'
=
f
.
select
:notification_email
,
@user
.
all_
public_
emails
,
{
include_blank:
'Global notification email'
},
class:
'select2 js-group-notification-email'
changelogs/unreleased/197790-hide-private-commit-emails-in-notification-settings.yml
0 → 100644
View file @
82cd20ac
---
title
:
Hide the private commit email in Notification email list
merge_request
:
25099
author
:
briankabiro
type
:
changed
spec/models/user_spec.rb
View file @
82cd20ac
...
...
@@ -1943,18 +1943,28 @@ describe User, :do_not_mock_admin_mode do
describe
'#all_emails'
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:email_confirmed
)
{
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
}
let!
(
:email_unconfirmed
)
{
create
:email
,
user:
user
}
context
'when `include_private_email` is true'
do
it
'returns all emails'
do
expect
(
user
.
reload
.
all_emails
).
to
contain_exactly
(
user
.
email
,
user
.
private_commit_email
,
email_unconfirmed
.
email
,
email_confirmed
.
email
)
end
end
it
'returns all emails'
do
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_unconfirmed
=
create
:email
,
user:
user
user
.
reload
expect
(
user
.
all_emails
).
to
contain_exactly
(
user
.
email
,
user
.
private_commit_email
,
email_unconfirmed
.
email
,
email_confirmed
.
email
)
context
'when `include_private_email` is false'
do
it
'does not include the private commit email'
do
expect
(
user
.
reload
.
all_emails
(
include_private_email:
false
)).
to
contain_exactly
(
user
.
email
,
email_unconfirmed
.
email
,
email_confirmed
.
email
)
end
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