Commit e90f195a authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 375ce71b c0af9800
- form = local_assigns.fetch(:form)
.form-group
= 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
= local_assigns.fetch(:help_text, nil)
.form-group
......
......@@ -70,6 +70,7 @@ Your **Global notification settings** are the default settings unless you select
different values for a project or a group.
- **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
[periodic emails](#product-marketing-emails) about GitLab features.
- **Global notification level**: the default [notification level](#notification-levels)
......
......@@ -97,7 +97,9 @@ module Gitlab
def observe_queue_size(size_proc, runner_type)
return unless Feature.enabled?(:gitlab_ci_builds_queuing_metrics, default_enabled: false)
self.class.queue_size_total.observe({ runner_type: runner_type }, size_proc.call.to_f)
size = size_proc.call.to_f
self.class.queue_size_total.observe({ runner_type: runner_type }, size)
self.class.current_queue_size.set({ runner_type: runner_type }, size)
end
def observe_queue_time(metric, runner_type)
......@@ -199,6 +201,15 @@ module Gitlab
end
end
def self.current_queue_size
strong_memoize(:current_queue_size) do
name = :gitlab_ci_current_queue_size
comment = 'Current size of initialized CI/CD builds queue'
Gitlab::Metrics.gauge(name, comment)
end
end
def self.queue_iteration_duration_seconds
strong_memoize(:queue_iteration_duration_seconds) do
name = :gitlab_ci_queue_iteration_duration_seconds
......
......@@ -153,6 +153,10 @@ module Gitlab
method_visibility = method_visibility_for(target, name)
# We silence warnings to avoid such warnings:
# `Skipping set of ruby2_keywords flag for <...>
# (method accepts keywords or method does not accept argument splat)`
# as we apply ruby2_keywords 'blindly' for every instrumented method.
proxy_module.class_eval <<-EOF, __FILE__, __LINE__ + 1
def #{name}(#{args_signature})
if trans = Gitlab::Metrics::Instrumentation.transaction
......@@ -162,6 +166,7 @@ module Gitlab
super
end
end
silence_warnings { ruby2_keywords(:#{name}) if respond_to?(:ruby2_keywords, true) }
#{method_visibility} :#{name}
EOF
......
......@@ -36265,6 +36265,9 @@ msgstr ""
msgid "Use one line per URI"
msgstr ""
msgid "Use primary email (%{email})"
msgstr ""
msgid "Use shortcuts"
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