diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 09:40:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 09:40:42 +0000 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /app/presenters | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) | |
download | gitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/ci/pipeline_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/deploy_key_presenter.rb | 9 | ||||
-rw-r--r-- | app/presenters/event_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/key_presenter.rb | 22 |
5 files changed, 37 insertions, 2 deletions
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 71a05ef2c72..706608e3029 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -34,7 +34,9 @@ module Ci def runner_variables stop_expanding_file_vars = ::Feature.enabled?(:ci_stop_expanding_file_vars_for_runners, project) - variables.sort_and_expand_all(keep_undefined: true, expand_file_vars: !stop_expanding_file_vars).to_runner_variables + variables + .sort_and_expand_all(keep_undefined: true, expand_file_vars: !stop_expanding_file_vars, project: project) + .to_runner_variables end def refspecs diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 32a7d205f46..fed4ae7837b 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -92,7 +92,7 @@ module Ci if all_related_merge_requests.none? _("No related merge requests found.") else - _("%{count} related %{pluralized_subject}: %{links}" % { + (_("%{count} related %{pluralized_subject}: %{links}") % { count: all_related_merge_requests.count, pluralized_subject: n_('merge request', 'merge requests', all_related_merge_requests.count), links: all_related_merge_request_links(limit: limit).join(', ') diff --git a/app/presenters/deploy_key_presenter.rb b/app/presenters/deploy_key_presenter.rb new file mode 100644 index 00000000000..6f32487b6f6 --- /dev/null +++ b/app/presenters/deploy_key_presenter.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class DeployKeyPresenter < KeyPresenter # rubocop:disable Gitlab/NamespacedClass + presents ::DeployKey, as: :deploy_key + + def humanized_error_message + super(type: :deploy_key) + end +end diff --git a/app/presenters/event_presenter.rb b/app/presenters/event_presenter.rb index 7fa87d33c0d..2f2fb1aa3ba 100644 --- a/app/presenters/event_presenter.rb +++ b/app/presenters/event_presenter.rb @@ -36,6 +36,8 @@ class EventPresenter < Gitlab::View::Presenter::Delegated 'Design' elsif wiki_page? 'Wiki Page' + elsif issue? || work_item? + target.issue_type elsif target_type.present? target_type.titleize else diff --git a/app/presenters/key_presenter.rb b/app/presenters/key_presenter.rb new file mode 100644 index 00000000000..e3eb5feedbf --- /dev/null +++ b/app/presenters/key_presenter.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class KeyPresenter < Gitlab::View::Presenter::Delegated # rubocop:disable Gitlab/NamespacedClass + presents ::Key, as: :key_object + + def humanized_error_message(type: :key) + if !key_object.public_key.valid? + help_link = help_page_link(_('supported SSH public key.'), 'user/ssh', 'supported-ssh-key-types') + + _('%{type} must be a %{help_link}').html_safe % { type: type.to_s.titleize, help_link: help_link } + else + key_object.errors.full_messages.join(', ').html_safe + end + end + + private + + def help_page_link(title, path, anchor) + ActionController::Base.helpers.link_to(title, help_page_path(path, anchor: anchor), + target: '_blank', rel: 'noopener noreferrer') + end +end |