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
a119c16f
Commit
a119c16f
authored
Feb 10, 2021
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user setting for opting into marketing emails
Used for determining whether to send marketing emails
parent
d4e96792
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
2 deletions
+18
-2
app/assets/javascripts/profile/profile.js
app/assets/javascripts/profile/profile.js
+1
-0
app/controllers/profiles/notifications_controller.rb
app/controllers/profiles/notifications_controller.rb
+1
-1
app/views/profiles/notifications/_email_settings.html.haml
app/views/profiles/notifications/_email_settings.html.haml
+4
-0
changelogs/unreleased/add-user-setting-for-opting-into-marketing-emails.yml
...sed/add-user-setting-for-opting-into-marketing-emails.yml
+5
-0
doc/user/profile/notifications.md
doc/user/profile/notifications.md
+2
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/controllers/profiles/notifications_controller_spec.rb
spec/controllers/profiles/notifications_controller_spec.rb
+2
-1
No files found.
app/assets/javascripts/profile/profile.js
View file @
a119c16f
...
...
@@ -42,6 +42,7 @@ export default class Profile {
$
(
'
#user_notification_email
'
).
on
(
'
select2-selecting
'
,
(
event
)
=>
{
setTimeout
(
this
.
submitForm
.
bind
(
event
.
currentTarget
));
});
$
(
'
#user_email_opted_in
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notified_of_own_activity
'
).
on
(
'
change
'
,
this
.
submitForm
);
this
.
form
.
on
(
'
submit
'
,
this
.
onSubmitForm
);
}
...
...
app/controllers/profiles/notifications_controller.rb
View file @
a119c16f
...
...
@@ -29,7 +29,7 @@ class Profiles::NotificationsController < Profiles::ApplicationController
end
def
user_params
params
.
require
(
:user
).
permit
(
:notification_email
,
:notified_of_own_activity
)
params
.
require
(
:user
).
permit
(
:notification_email
,
:
email_opted_in
,
:
notified_of_own_activity
)
end
private
...
...
app/views/profiles/notifications/_email_settings.html.haml
View file @
a119c16f
...
...
@@ -4,3 +4,7 @@
=
form
.
select
:notification_email
,
@user
.
public_verified_emails
,
{
include_blank:
false
},
class:
"select2"
,
disabled:
local_assigns
.
fetch
(
:email_change_disabled
,
nil
)
.help-block
=
local_assigns
.
fetch
(
:help_text
,
nil
)
.form-group
%label
{
for:
'user_email_opted_in'
}
=
form
.
check_box
:email_opted_in
%span
=
_
(
'Receive product marketing emails'
)
changelogs/unreleased/add-user-setting-for-opting-into-marketing-emails.yml
0 → 100644
View file @
a119c16f
---
title
:
Add user setting for opting into marketing emails
merge_request
:
53921
author
:
type
:
added
doc/user/profile/notifications.md
View file @
a119c16f
...
...
@@ -56,6 +56,8 @@ Your **Global notification settings** are the default settings unless you select
-
This is the email address your notifications are sent to.
-
Global notification level
-
This is the default
[
notification level
](
#notification-levels
)
which applies to all your notifications.
-
Receive product marketing emails
-
Check this checkbox if you want to receive periodic emails related to GitLab features.
-
Receive notifications about your own activity.
-
Check this checkbox if you want to receive notification about your own activity. Default: Not checked.
...
...
locale/gitlab.pot
View file @
a119c16f
...
...
@@ -24060,6 +24060,9 @@ msgstr ""
msgid "Receive notifications about your own activity"
msgstr ""
msgid "Receive product marketing emails"
msgstr ""
msgid "Recent"
msgstr ""
...
...
spec/controllers/profiles/notifications_controller_spec.rb
View file @
a119c16f
...
...
@@ -119,10 +119,11 @@ RSpec.describe Profiles::NotificationsController do
it
'updates only permitted attributes'
do
sign_in
(
user
)
put
:update
,
params:
{
user:
{
notification_email:
'new@example.com'
,
notified_of_own_activity:
true
,
admin:
true
}
}
put
:update
,
params:
{
user:
{
notification_email:
'new@example.com'
,
email_opted_in:
true
,
notified_of_own_activity:
true
,
admin:
true
}
}
user
.
reload
expect
(
user
.
notification_email
).
to
eq
(
'new@example.com'
)
expect
(
user
.
email_opted_in
).
to
eq
(
true
)
expect
(
user
.
notified_of_own_activity
).
to
eq
(
true
)
expect
(
user
.
admin
).
to
eq
(
false
)
expect
(
controller
).
to
set_flash
[
:notice
].
to
(
'Notification settings saved'
)
...
...
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