Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-02 18:09:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-02 18:09:54 +0300
commitd944f09d3212ca8aad09b92dbbae7323ee634237 (patch)
treebd2af8e867fb1baf2c2687fd12adab26515f3230 /app
parentae9f43a2c4bda0ee7dae59ea9a7d412068f6f7ff (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue21
-rw-r--r--app/models/concerns/exportable.rb50
-rw-r--r--app/models/issue.rb1
-rw-r--r--app/models/note.rb6
-rw-r--r--app/views/groups/settings/_transfer.html.haml3
-rw-r--r--app/views/notify/autodevops_disabled_email.html.haml4
-rw-r--r--app/views/notify/two_factor_otp_attempt_failed_email.html.haml2
-rw-r--r--app/views/notify/two_factor_otp_attempt_failed_email.text.haml2
-rw-r--r--app/views/notify/unknown_sign_in_email.html.haml5
-rw-r--r--app/views/notify/unknown_sign_in_email.text.haml4
-rw-r--r--app/views/shared/integrations/mattermost_slash_commands/_detailed_help.html.haml4
11 files changed, 85 insertions, 17 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
index 7cfc9431c2a..1e7dd639247 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
@@ -323,16 +323,25 @@ export default {
data-testid="widget-extension-top-level"
>
<div
- class="gl-flex-grow-1 gl-display-flex gl-align-items-center"
+ class="gl-flex-grow-1 gl-display-flex gl-align-items-center gl-flex-wrap"
data-testid="widget-extension-top-level-summary"
>
- <template v-if="isLoadingSummary">{{ widgetLoadingText }}</template>
- <template v-else-if="hasFetchError">{{ widgetErrorText }}</template>
+ <div v-if="isLoadingSummary" class="gl-w-full gl-line-height-normal">
+ {{ widgetLoadingText }}
+ </div>
+ <div v-else-if="hasFetchError" class="gl-w-full gl-line-height-normal">
+ {{ widgetErrorText }}
+ </div>
<template v-else>
- <span v-safe-html="hydratedSummary.subject"></span>
+ <div
+ v-safe-html="hydratedSummary.subject"
+ class="gl-w-full gl-line-height-normal"
+ ></div>
<template v-if="hydratedSummary.meta">
- <br />
- <span v-safe-html="hydratedSummary.meta" class="gl-font-sm"></span>
+ <div
+ v-safe-html="hydratedSummary.meta"
+ class="gl-w-full gl-font-sm gl-line-height-normal"
+ ></div>
</template>
</template>
</div>
diff --git a/app/models/concerns/exportable.rb b/app/models/concerns/exportable.rb
new file mode 100644
index 00000000000..066a44912be
--- /dev/null
+++ b/app/models/concerns/exportable.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+module Exportable
+ extend ActiveSupport::Concern
+
+ def readable_records(association, current_user: nil)
+ association_records = try(association)
+ return unless association_records.present?
+
+ if has_many_association?(association)
+ DeclarativePolicy.user_scope do
+ association_records.select { |record| readable_record?(record, current_user) }
+ end
+ else
+ readable_record?(association_records, current_user) ? association_records : nil
+ end
+ end
+
+ def exportable_association?(association, current_user: nil)
+ return false unless respond_to?(association)
+ return true if has_many_association?(association)
+
+ readable = try(association)
+ return true if readable.nil?
+
+ readable_record?(readable, current_user)
+ end
+
+ def restricted_associations(keys)
+ exportable_restricted_associations & keys
+ end
+
+ def has_many_association?(association_name)
+ self.class.reflect_on_association(association_name)&.macro == :has_many
+ end
+
+ private
+
+ def exportable_restricted_associations
+ []
+ end
+
+ def readable_record?(record, user)
+ if record.respond_to?(:exportable_record?)
+ record.exportable_record?(user)
+ else
+ record.readable_by?(user)
+ end
+ end
+end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 6744ee230b0..ff5fb61146e 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -25,6 +25,7 @@ class Issue < ApplicationRecord
include FromUnion
include EachBatch
include PgFullTextSearchable
+ include Exportable
extend ::Gitlab::Utils::Override
diff --git a/app/models/note.rb b/app/models/note.rb
index c0299867b0e..57a1ae1ac45 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -710,6 +710,12 @@ class Note < ApplicationRecord
confidential? ? :read_internal_note : :read_note
end
+ def exportable_record?(user)
+ return true unless system?
+
+ readable_by?(user)
+ end
+
private
def system_note_viewable_by?(user)
diff --git a/app/views/groups/settings/_transfer.html.haml b/app/views/groups/settings/_transfer.html.haml
index 3c76e8a864a..d064ac36768 100644
--- a/app/views/groups/settings/_transfer.html.haml
+++ b/app/views/groups/settings/_transfer.html.haml
@@ -6,7 +6,8 @@
%p= _('Transfer group to another parent group.')
= form_for group, url: transfer_group_path(group), method: :put, html: { id: form_id, class: 'js-group-transfer-form' } do |f|
%ul
- - learn_more_link_start = '<a href="https://docs.gitlab.com/ee/user/project/repository/index.html#what-happens-when-a-repository-path-changes" target="_blank" rel="noopener noreferrer">'.html_safe
+ - learn_more_link = help_page_url('user/project/repository/index', anchor: 'what-happens-when-a-repository-path-changes')
+ - learn_more_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: learn_more_link }
- warning_text = s_("GroupSettings|Be careful. Changing a group's parent can have unintended side effects. %{learn_more_link_start}Learn more.%{learn_more_link_end}") % { learn_more_link_start: learn_more_link_start, learn_more_link_end: '</a>'.html_safe }
%li= warning_text.html_safe
%li= s_('GroupSettings|You can only transfer the group to a group you manage.')
diff --git a/app/views/notify/autodevops_disabled_email.html.haml b/app/views/notify/autodevops_disabled_email.html.haml
index d6812821966..f634a749008 100644
--- a/app/views/notify/autodevops_disabled_email.html.haml
+++ b/app/views/notify/autodevops_disabled_email.html.haml
@@ -11,13 +11,13 @@
- link_style = "color: #1b69b6; text-decoration:none;"
- pipeline_link = link_to("\##{@pipeline.iid}", pipeline_url(@pipeline), style: link_style).html_safe
- project_link = link_to(@project.name, project_url(@project), style: link_style).html_safe
- - supported_langs_link = link_to(s_('Notify|currently supported languages'), 'https://docs.gitlab.com/ee/topics/autodevops/#currently-supported-languages', style: link_style).html_safe
+ - supported_langs_link = link_to(s_('Notify|currently supported languages'), help_page_url('topics/autodevops/stages', anchor: 'currently-supported-languages'), style: link_style).html_safe
- settings_link = link_to(s_('Notify|CI/CD project settings'), project_settings_ci_cd_url(@project), style: link_style).html_safe
= s_('Notify|The Auto DevOps pipeline failed for pipeline %{pipeline_link} and has been disabled for %{project_link}. In order to use the Auto DevOps pipeline with your project, please review the %{supported_langs_link}, adjust your project accordingly, and turn on the Auto DevOps pipeline within your %{settings_link}.').html_safe % { pipeline_link: pipeline_link, project_link: project_link, supported_langs_link: supported_langs_link, settings_link: settings_link }
%tr.pre-section
%td{ style: 'text-align: center;border-bottom:1px solid #ededed' }
- %a{ href: 'https://docs.gitlab.com/ee/topics/autodevops/', style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;" }
+ %a{ href: help_page_url('topics/autodevops/index'), style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;" }
%button{ type: 'button', style: 'border-color: #dfdfdf; border-style: solid; border-width: 1px; border-radius: 4px; font-size: 14px; padding: 8px 16px; background-color:#fff; margin: 8px 0; cursor: pointer;' }
= s_('Notify|Learn more about Auto DevOps')
diff --git a/app/views/notify/two_factor_otp_attempt_failed_email.html.haml b/app/views/notify/two_factor_otp_attempt_failed_email.html.haml
index fec7083e524..83f028af500 100644
--- a/app/views/notify/two_factor_otp_attempt_failed_email.html.haml
+++ b/app/views/notify/two_factor_otp_attempt_failed_email.html.haml
@@ -42,7 +42,7 @@
%tbody
%tr{ style: 'width:100%;' }
%td{ style: "#{default_style}text-align:center;" }
- - password_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: 'https://docs.gitlab.com/ee/user/profile/user_passwords.html#change-your-password' }
+ - password_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_url('user/profile/user_passwords', anchor: 'change-your-password') }
= _('If you recently tried to sign in, but mistakenly entered a wrong two-factor authentication code, you may ignore this email.')
- if password_authentication_enabled_for_web?
diff --git a/app/views/notify/two_factor_otp_attempt_failed_email.text.haml b/app/views/notify/two_factor_otp_attempt_failed_email.text.haml
index 8f839cd83ee..8718ab034ff 100644
--- a/app/views/notify/two_factor_otp_attempt_failed_email.text.haml
+++ b/app/views/notify/two_factor_otp_attempt_failed_email.text.haml
@@ -3,5 +3,5 @@
= _('We detected an attempt to sign in to your %{host} account using a wrong two-factor authentication code, from the following IP address: %{ip}, at %{time}') % { host: Gitlab.config.gitlab.host, ip: @ip, time: @time }
= _('If you recently tried to sign in, but mistakenly entered a wrong two-factor authentication code, you may ignore this email.')
-= _('If you did not recently try to sign in, you should immediately change your password: %{password_link}.') % { password_link: 'https://docs.gitlab.com/ee/user/profile/user_passwords.html#change-your-password' }
+= _('If you did not recently try to sign in, you should immediately change your password: %{password_link}.') % { password_link: help_page_url('user/profile/user_passwords', anchor: 'change-your-password') }
= _('Make sure you choose a strong, unique password.')
diff --git a/app/views/notify/unknown_sign_in_email.html.haml b/app/views/notify/unknown_sign_in_email.html.haml
index 64bf4e7b4e8..f8a0ae1352c 100644
--- a/app/views/notify/unknown_sign_in_email.html.haml
+++ b/app/views/notify/unknown_sign_in_email.html.haml
@@ -42,7 +42,7 @@
%tbody
%tr{ style: 'width:100%;' }
%td{ style: "#{default_style}text-align:center;" }
- - password_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: 'https://docs.gitlab.com/ee/user/profile/user_passwords.html#change-your-password' }
+ - password_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_url('user/profile/user_passwords', anchor: 'change-your-password') }
= _('If you recently signed in and recognize the IP address, you may disregard this email.')
- if password_authentication_enabled_for_web?
@@ -52,5 +52,6 @@
- unless @user.two_factor_enabled?
%p
- - mfa_link_start = '<a href="https://docs.gitlab.com/ee/user/profile/account/two_factor_authentication.html" target="_blank">'.html_safe
+ - mfa_url = help_page_url('user/profile/account/two_factor_authentication')
+ - mfa_link_start = '<a href="%{url}" target="_blank">'.html_safe % { url: mfa_url }
= _('To further protect your account, consider configuring a %{mfa_link_start}two-factor authentication%{mfa_link_end} method.').html_safe % { mfa_link_start: mfa_link_start, mfa_link_end: '</a>'.html_safe }
diff --git a/app/views/notify/unknown_sign_in_email.text.haml b/app/views/notify/unknown_sign_in_email.text.haml
index 54c7a245ab9..f3e318f0d15 100644
--- a/app/views/notify/unknown_sign_in_email.text.haml
+++ b/app/views/notify/unknown_sign_in_email.text.haml
@@ -3,8 +3,8 @@
= _('A sign-in to your account has been made from the following IP address: %{ip}') % { ip: @ip }
= _('If you recently signed in and recognize the IP address, you may disregard this email.')
-= _('If you did not recently sign in, you should immediately change your password: %{password_link}.') % { password_link: 'https://docs.gitlab.com/ee/user/profile/user_passwords.html#change-your-password' }
+= _('If you did not recently sign in, you should immediately change your password: %{password_link}.') % { password_link: help_page_url('user/profile/user_passwords', anchor: 'change-your-password') }
= _('Passwords should be unique and not used for any other sites or services.')
- unless @user.two_factor_enabled?
- = _('To further protect your account, consider configuring a two-factor authentication method: %{mfa_link}.') % { mfa_link: 'https://docs.gitlab.com/ee/user/profile/account/two_factor_authentication.html' }
+ = _('To further protect your account, consider configuring a two-factor authentication method: %{mfa_link}.') % { mfa_link: help_page_url('user/profile/account/two_factor_authentication') }
diff --git a/app/views/shared/integrations/mattermost_slash_commands/_detailed_help.html.haml b/app/views/shared/integrations/mattermost_slash_commands/_detailed_help.html.haml
index fec443738c3..db1754c1864 100644
--- a/app/views/shared/integrations/mattermost_slash_commands/_detailed_help.html.haml
+++ b/app/views/shared/integrations/mattermost_slash_commands/_detailed_help.html.haml
@@ -5,13 +5,13 @@
%ul.list-unstyled.indent-list
%li
1.
- = link_to 'https://docs.gitlab.com/ee/user/project/integrations/mattermost_slash_commands.html#enable-custom-slash-commands', target: '_blank', rel: 'noopener noreferrer nofollow' do
+ = link_to help_page_url('user/project/integrations/mattermost_slash_commands', anchor: 'enable-custom-slash-commands-in-mattermost'), target: '_blank', rel: 'noopener noreferrer nofollow' do
Enable custom slash commands
= sprite_icon('external-link')
on your Mattermost installation.
%li
2.
- = link_to 'https://docs.gitlab.com/ee/user/project/integrations/mattermost_slash_commands.html#create-a-slash-command', target: '_blank', rel: 'noopener noreferrer nofollow' do
+ = link_to help_page_url('user/project/integrations/mattermost_slash_commands', anchor: 'create-a-slash-command-in-mattermost'), target: '_blank', rel: 'noopener noreferrer nofollow' do
Add a slash command
= sprite_icon('external-link')
in your Mattermost team with the options listed below.