Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-11-04 03:21:00 +00:00
parent 830ab7c6cb
commit 205a28dcdf
6 changed files with 218 additions and 38 deletions

View File

@ -173,7 +173,6 @@ Layout/LineLength:
- 'app/helpers/compare_helper.rb'
- 'app/helpers/diff_helper.rb'
- 'app/helpers/dropdowns_helper.rb'
- 'app/helpers/emails_helper.rb'
- 'app/helpers/events_helper.rb'
- 'app/helpers/export_helper.rb'
- 'app/helpers/external_link_helper.rb'

View File

@ -111,7 +111,10 @@ module EmailsHelper
safe_format(_("Issue was closed by %{name} with merge request %{link}"), name: name, link: merge_request_link)
else
# If it's not HTML nor text then assume it's text to be safe
_("Issue was closed by %{name} with merge request %{link}") % { name: name, link: "#{merge_request.to_reference} (#{merge_request.web_url})" }
_("Issue was closed by %{name} with merge request %{link}") % {
name: name,
link: "#{merge_request.to_reference} (#{merge_request.web_url})"
}
end
when String
# Technically speaking this should be Commit but per
@ -132,11 +135,25 @@ module EmailsHelper
end
# "You are receiving this email because ... on #{host}. ..."
def notification_reason_text(reason: nil, show_manage_notifications_link: false, show_help_link: false, manage_label_subscriptions_url: nil, unsubscribe_url: nil, format: :text)
def notification_reason_text(
reason: nil,
show_manage_notifications_link: false,
show_help_link: false,
manage_label_subscriptions_url: nil,
unsubscribe_url: nil,
format: :text
)
if unsubscribe_url && show_manage_notifications_link && show_help_link
notification_reason_text_with_unsubscribe_and_manage_notifications_and_help_links(reason: reason, unsubscribe_url: unsubscribe_url, format: format)
notification_reason_text_with_unsubscribe_and_manage_notifications_and_help_links(
reason: reason,
unsubscribe_url: unsubscribe_url,
format: format
)
elsif !reason && manage_label_subscriptions_url && show_help_link
notification_reason_text_with_manage_label_subscriptions_and_help_links(manage_label_subscriptions_url: manage_label_subscriptions_url, format: format)
notification_reason_text_with_manage_label_subscriptions_and_help_links(
manage_label_subscriptions_url: manage_label_subscriptions_url,
format: format
)
elsif show_manage_notifications_link && show_help_link
notification_reason_text_with_manage_notifications_and_help_links(reason: reason, format: format)
else
@ -213,10 +230,13 @@ module EmailsHelper
case format
when :html
settings_link_to = generate_link(_('two-factor authentication settings'), url).html_safe
_("If you want to re-enable two-factor authentication, visit the %{settings_link_to} page.").html_safe % { settings_link_to: settings_link_to }
_("If you want to re-enable two-factor authentication, visit the %{settings_link_to} page.").html_safe % {
settings_link_to: settings_link_to
}
else
_('If you want to re-enable two-factor authentication, visit %{two_factor_link}') %
{ two_factor_link: url }
_('If you want to re-enable two-factor authentication, visit %{two_factor_link}') % {
two_factor_link: url
}
end
end
@ -230,7 +250,9 @@ module EmailsHelper
case format
when :html
settings_link_to = generate_link(_('email address settings'), url).html_safe
_("If you want to remove this email address, visit the %{settings_link_to} page.").html_safe % { settings_link_to: settings_link_to }
_("If you want to remove this email address, visit the %{settings_link_to} page.").html_safe % {
settings_link_to: settings_link_to
}
else
_('If you want to remove this email address, visit %{profile_link}') %
{ profile_link: url }
@ -262,9 +284,18 @@ module EmailsHelper
case format
when :html
link_to = generate_link(member_source.human_name, url).html_safe
safe_format(_("Your membership in %{link_to} %{project_or_group_name} will expire in %{days_formatted}."), link_to: link_to, project_or_group_name: member_source.model_name.singular, days_formatted: days_formatted)
safe_format(
_("Your membership in %{link_to} %{project_or_group_name} will expire in %{days_formatted}."),
link_to: link_to,
project_or_group_name: member_source.model_name.singular,
days_formatted: days_formatted
)
else
_("Your membership in %{project_or_group} %{project_or_group_name} will expire in %{days_formatted}.") % { project_or_group: member_source.human_name, project_or_group_name: member_source.model_name.singular, days_formatted: days_formatted }
_("Your membership in %{project_or_group} %{project_or_group_name} will expire in %{days_formatted}.") % {
project_or_group: member_source.human_name,
project_or_group_name: member_source.model_name.singular,
days_formatted: days_formatted
}
end
end
@ -281,9 +312,17 @@ module EmailsHelper
case format
when :html
link_to = generate_link("#{member_source.class.name.downcase} membership", url).html_safe
safe_format(_('For additional information, review your %{link_to} or contact your %{project_or_group} owner.'), link_to: link_to, project_or_group: project_or_group)
safe_format(
_('For additional information, review your %{link_to} or contact your %{project_or_group} owner.'),
link_to: link_to,
project_or_group: project_or_group
)
else
_('For additional information, review your %{project_or_group} membership: %{url} or contact your %{project_or_group} owner.') % { project_or_group: project_or_group, url: url }
_('For additional information, review your %{project_or_group} membership: %{url} or contact your ' \
'%{project_or_group} owner.') % {
project_or_group: project_or_group,
url: url
}
end
end
@ -304,14 +343,21 @@ module EmailsHelper
case format
when :html
link_to = generate_link('group membership', url).html_safe
_('For additional information, review your %{link_to} or contact your group owner.').html_safe % { link_to: link_to }
_('For additional information, review your %{link_to} or contact your group owner.').html_safe % {
link_to: link_to
}
else
_('For additional information, review your group membership: %{link_to} or contact your group owner.') % { link_to: url }
_('For additional information, review your group membership: %{link_to} or contact your group owner.') % {
link_to: url
}
end
end
def instance_access_request_text(user, format: nil)
_('%{username} has asked for a GitLab account on your instance %{host}:').html_safe % { username: sanitize_name(user.name), host: gitlab_host_link(format) }
_('%{username} has asked for a GitLab account on your instance %{host}:').html_safe % {
username: sanitize_name(user.name),
host: gitlab_host_link(format)
}
end
def instance_access_request_link(user, format: nil)
@ -320,7 +366,10 @@ module EmailsHelper
case format
when :html
user_page = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: url }
_("Click %{link_start}here%{link_end} to view the request.").html_safe % { link_start: user_page, link_end: '</a>'.html_safe }
_("Click %{link_start}here%{link_end} to view the request.").html_safe % {
link_start: user_page,
link_end: '</a>'.html_safe
}
else
_('Click %{link_to} to view the request.') % { link_to: url }
end
@ -412,63 +461,173 @@ module EmailsHelper
end
end
def notification_reason_text_with_unsubscribe_and_manage_notifications_and_help_links(reason:, unsubscribe_url:, format:)
unsubscribe_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: unsubscribe_url }
def notification_reason_text_with_unsubscribe_and_manage_notifications_and_help_links(
reason:,
unsubscribe_url:,
format:
)
unsubscribe_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % {
url: unsubscribe_url
}
unsubscribe_link_end = '</a>'.html_safe
manage_notifications_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % { url: profile_notifications_url }
manage_notifications_link_start =
'<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % {
url: profile_notifications_url
}
manage_notifications_link_end = '</a>'.html_safe
help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % { url: help_url }
help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % {
url: help_url
}
help_link_end = '</a>'.html_safe
case reason
when NotificationReason::OWN_ACTIVITY
_("You're receiving this email because of your activity on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because of your activity on %{host}. " \
"%{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; " \
"%{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; " \
"%{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
unsubscribe_link_start: unsubscribe_link_start,
unsubscribe_link_end: unsubscribe_link_end,
manage_notifications_link_start: manage_notifications_link_start,
manage_notifications_link_end: manage_notifications_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
when NotificationReason::ASSIGNED
_("You're receiving this email because you have been assigned an item on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because you have been assigned an item on %{host}. " \
"%{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; " \
"%{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; " \
"%{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
unsubscribe_link_start: unsubscribe_link_start,
unsubscribe_link_end: unsubscribe_link_end,
manage_notifications_link_start: manage_notifications_link_start,
manage_notifications_link_end: manage_notifications_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
when NotificationReason::MENTIONED
_("You're receiving this email because you have been mentioned on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because you have been mentioned on %{host}. " \
"%{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; " \
"%{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; " \
"%{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
unsubscribe_link_start: unsubscribe_link_start,
unsubscribe_link_end: unsubscribe_link_end,
manage_notifications_link_start: manage_notifications_link_start,
manage_notifications_link_end: manage_notifications_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
else
_("You're receiving this email because of your account on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because of your account on %{host}. " \
"%{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread &middot; " \
"%{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; " \
"%{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
unsubscribe_link_start: unsubscribe_link_start,
unsubscribe_link_end: unsubscribe_link_end,
manage_notifications_link_start: manage_notifications_link_start,
manage_notifications_link_end: manage_notifications_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
end
end
def notification_reason_text_with_manage_label_subscriptions_and_help_links(manage_label_subscriptions_url:, format:)
manage_label_subscriptions_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % { url: manage_label_subscriptions_url }
manage_label_subscriptions_link_start =
'<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % {
url: manage_label_subscriptions_url
}
manage_label_subscriptions_link_end = '</a>'.html_safe
help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % { url: help_url }
help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % {
url: help_url
}
help_link_end = '</a>'.html_safe
_("You're receiving this email because of your account on %{host}. %{manage_label_subscriptions_link_start}Manage label subscriptions%{manage_label_subscriptions_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), manage_label_subscriptions_link_start: manage_label_subscriptions_link_start, manage_label_subscriptions_link_end: manage_label_subscriptions_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because of your account on %{host}. %{manage_label_subscriptions_link_start}" \
"Manage label subscriptions%{manage_label_subscriptions_link_end} &middot; " \
"%{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
manage_label_subscriptions_link_start: manage_label_subscriptions_link_start,
manage_label_subscriptions_link_end: manage_label_subscriptions_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
end
def notification_reason_text_with_manage_notifications_and_help_links(reason:, format:)
manage_notifications_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % { url: profile_notifications_url }
manage_notifications_link_start =
'<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % {
url: profile_notifications_url
}
manage_notifications_link_end = '</a>'.html_safe
help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % { url: help_url }
help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % {
url: help_url
}
help_link_end = '</a>'.html_safe
case reason
when NotificationReason::MENTIONED
_("You're receiving this email because you have been mentioned on %{host}. %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because you have been mentioned on %{host}. " \
"%{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; " \
"%{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
manage_notifications_link_start: manage_notifications_link_start,
manage_notifications_link_end: manage_notifications_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
else
_("You're receiving this email because of your account on %{host}. %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end }
_(
"You're receiving this email because of your account on %{host}. %{manage_notifications_link_start}Manage " \
"all notifications%{manage_notifications_link_end} &middot; %{help_link_start}Help%{help_link_end}"
).html_safe % {
host: gitlab_host_link(format),
manage_notifications_link_start: manage_notifications_link_start,
manage_notifications_link_end: manage_notifications_link_end,
help_link_start: help_link_start,
help_link_end: help_link_end
}
end
end
def notification_reason_text_without_links(reason:, format:)
case reason
when NotificationReason::OWN_ACTIVITY
_("You're receiving this email because of your activity on %{host}.").html_safe % { host: gitlab_host_link(format) }
_("You're receiving this email because of your activity on %{host}.").html_safe % {
host: gitlab_host_link(format)
}
when NotificationReason::ASSIGNED
_("You're receiving this email because you have been assigned an item on %{host}.").html_safe % { host: gitlab_host_link(format) }
_("You're receiving this email because you have been assigned an item on %{host}.").html_safe % {
host: gitlab_host_link(format)
}
when NotificationReason::MENTIONED
_("You're receiving this email because you have been mentioned on %{host}.").html_safe % { host: gitlab_host_link(format) }
_("You're receiving this email because you have been mentioned on %{host}.").html_safe % {
host: gitlab_host_link(format)
}
else
_("You're receiving this email because of your account on %{host}.").html_safe % { host: gitlab_host_link(format) }
_("You're receiving this email because of your account on %{host}.").html_safe % {
host: gitlab_host_link(format)
}
end
end
end

View File

@ -5,4 +5,4 @@ feature_category: dynamic_application_security_testing
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/155285
milestone: '17.1'
queued_migration_version: 20240604145223
finalized_by: # version of the migration that finalized this BBM
finalized_by: '20241103232239'

View File

@ -0,0 +1,21 @@
# frozen_string_literal: true
class FinalizeBackfillDastProfilesTagsProjectId < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
def up
ensure_batched_background_migration_is_finished(
job_class_name: 'BackfillDastProfilesTagsProjectId',
table_name: :dast_profiles_tags,
column_name: :id,
job_arguments: [:project_id, :dast_profiles, :project_id, :dast_profile_id],
finalize: true
)
end
def down; end
end

View File

@ -0,0 +1 @@
79a80e3eebb1938c3ff27cc4388c2a4af31f289a7baa89333109a339385c7f16

View File

@ -154,7 +154,7 @@ algorithm. Each adaptive limit:
This mechanism provides some headroom for the machine to "breathe" and speeds up current inflight requests.
![Gitaly Adaptive Concurrency Limit](img/gitaly_adaptive_concurrency_limit_v16_6.png)
![Graph showing a Gitaly adaptive concurrency limit being adjusted based on the system resource usage by following the AIMD algorithm](img/gitaly_adaptive_concurrency_limit_v16_6.png)
The adaptive limiter calibrates the limits every 30 seconds and: