Commit c0af9800 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'djensen-add-notification-email-form-default-value' into 'master'

Only set User#notification_email with user input

See merge request gitlab-org/gitlab!68687
parents 985a2b2c 6b07127a
- form = local_assigns.fetch(:form) - form = local_assigns.fetch(:form)
.form-group .form-group
= form.label :notification_email, class: "label-bold" = form.label :notification_email, class: "label-bold"
= form.select :notification_email, @user.public_verified_emails, { include_blank: false }, class: "select2", disabled: local_assigns.fetch(:email_change_disabled, nil) = form.select :notification_email, @user.public_verified_emails, { include_blank: _('Use primary email (%{email})') % { email: @user.email }, selected: @user.read_attribute(:notification_email) }, class: "select2", disabled: local_assigns.fetch(:email_change_disabled, nil)
.help-block .help-block
= local_assigns.fetch(:help_text, nil) = local_assigns.fetch(:help_text, nil)
.form-group .form-group
......
...@@ -70,6 +70,7 @@ Your **Global notification settings** are the default settings unless you select ...@@ -70,6 +70,7 @@ Your **Global notification settings** are the default settings unless you select
different values for a project or a group. different values for a project or a group.
- **Notification email**: the email address your notifications are sent to. - **Notification email**: the email address your notifications are sent to.
Defaults to your primary email address.
- **Receive product marketing emails**: select this checkbox to receive - **Receive product marketing emails**: select this checkbox to receive
[periodic emails](#product-marketing-emails) about GitLab features. [periodic emails](#product-marketing-emails) about GitLab features.
- **Global notification level**: the default [notification level](#notification-levels) - **Global notification level**: the default [notification level](#notification-levels)
......
...@@ -36265,6 +36265,9 @@ msgstr "" ...@@ -36265,6 +36265,9 @@ msgstr ""
msgid "Use one line per URI" msgid "Use one line per URI"
msgstr "" msgstr ""
msgid "Use primary email (%{email})"
msgstr ""
msgid "Use shortcuts" msgid "Use shortcuts"
msgstr "" msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'profiles/notifications/show' do
let(:groups) { GroupsFinder.new(user).execute.page(1) }
let(:user) { create(:user) }
before do
assign(:group_notifications, [])
assign(:project_notifications, [])
assign(:user, user)
assign(:user_groups, groups)
allow(controller).to receive(:current_user).and_return(user)
allow(view).to receive(:experiment_enabled?)
end
context 'when there is no database value for User#notification_email' do
let(:option_default) { _('Use primary email (%{email})') % { email: user.email } }
let(:option_primary_email) { user.email }
let(:options) { [option_default, option_primary_email] }
it 'displays the correct elements' do
render
expect(rendered).to have_select('user_notification_email', options: options, selected: nil)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment