diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-12 12:09:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-12 12:09:06 +0300 |
commit | 3159925155a86dfd41000c1467576927c18c8f58 (patch) | |
tree | d9c4673de198ac20e4e310ad299636649e47d2a8 /app | |
parent | 8ccbb53e68d2830e766e1cae4e9d158840d115b6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
13 files changed, 70 insertions, 54 deletions
diff --git a/app/assets/javascripts/pages/admin/index.js b/app/assets/javascripts/pages/admin/index.js index 792a6eda14e..8d5dfd689e8 100644 --- a/app/assets/javascripts/pages/admin/index.js +++ b/app/assets/javascripts/pages/admin/index.js @@ -2,10 +2,8 @@ import initAdminStatisticsPanel from '../../admin/statistics_panel/index'; import initVueAlerts from '../../vue_alerts'; import initAdmin from './admin'; -document.addEventListener('DOMContentLoaded', initVueAlerts); +initVueAlerts(); -document.addEventListener('DOMContentLoaded', () => { - const statisticsPanelContainer = document.getElementById('js-admin-statistics-container'); - initAdmin(); - initAdminStatisticsPanel(statisticsPanelContainer); -}); +const statisticsPanelContainer = document.getElementById('js-admin-statistics-container'); +initAdmin(); +initAdminStatisticsPanel(statisticsPanelContainer); diff --git a/app/assets/stylesheets/framework/highlight.scss b/app/assets/stylesheets/framework/highlight.scss index 28577e2801e..73a2170fc68 100644 --- a/app/assets/stylesheets/framework/highlight.scss +++ b/app/assets/stylesheets/framework/highlight.scss @@ -45,8 +45,7 @@ a { font-family: $monospace-font; - display: flex; - justify-content: flex-end; + display: block; font-size: $code-font-size !important; white-space: nowrap; diff --git a/app/graphql/mutations/boards/create.rb b/app/graphql/mutations/boards/create.rb index 003c4f7761b..fe324f848e7 100644 --- a/app/graphql/mutations/boards/create.rb +++ b/app/graphql/mutations/boards/create.rb @@ -22,7 +22,7 @@ module Mutations response = ::Boards::CreateService.new(board_parent, current_user, args).execute { - board: response.success? ? response.payload : nil, + board: response.payload, errors: response.errors } end diff --git a/app/graphql/types/global_id_type.rb b/app/graphql/types/global_id_type.rb index 007d86f60b8..750bd1bfe8d 100644 --- a/app/graphql/types/global_id_type.rb +++ b/app/graphql/types/global_id_type.rb @@ -19,7 +19,14 @@ end module Types class GlobalIDType < BaseScalar graphql_name 'GlobalID' - description 'A global identifier' + description <<~DESC + A global identifier. + + A global identifier represents an object uniquely across the application. + An example of such an identifier is "gid://gitlab/User/1". + + Global identifiers are encoded as strings. + DESC # @param value [GID] # @return [String] @@ -46,38 +53,40 @@ module Types @id_types[model_class] ||= Class.new(self) do graphql_name "#{model_class.name.gsub(/::/, '')}ID" - description "Identifier of #{model_class.name}." + description <<~MD + A `#{graphql_name}` is a global ID. It is encoded as a string. - self.define_singleton_method(:to_s) do + An example `#{graphql_name}` is: `"#{::Gitlab::GlobalId.build(model_name: model_class.name, id: 1)}"`. + MD + + define_singleton_method(:to_s) do graphql_name end - self.define_singleton_method(:inspect) do + define_singleton_method(:inspect) do graphql_name end - self.define_singleton_method(:coerce_result) do |gid, ctx| + define_singleton_method(:coerce_result) do |gid, ctx| global_id = ::Gitlab::GlobalId.as_global_id(gid, model_name: model_class.name) - if suitable?(global_id) - global_id.to_s - else - raise GraphQL::CoercionError, "Expected a #{model_class.name} ID, got #{global_id}" - end + next global_id.to_s if suitable?(global_id) + + raise GraphQL::CoercionError, "Expected a #{model_class.name} ID, got #{global_id}" end - self.define_singleton_method(:suitable?) do |gid| + define_singleton_method(:suitable?) do |gid| next false if gid.nil? gid.model_name.safe_constantize.present? && gid.model_class.ancestors.include?(model_class) end - self.define_singleton_method(:coerce_input) do |string, ctx| + define_singleton_method(:coerce_input) do |string, ctx| gid = super(string, ctx) - raise GraphQL::CoercionError, "#{string.inspect} does not represent an instance of #{model_class.name}" unless suitable?(gid) + next gid if suitable?(gid) - gid + raise GraphQL::CoercionError, "#{string.inspect} does not represent an instance of #{model_class.name}" end end end diff --git a/app/graphql/types/time_type.rb b/app/graphql/types/time_type.rb index c31e4873df0..2db14953308 100644 --- a/app/graphql/types/time_type.rb +++ b/app/graphql/types/time_type.rb @@ -3,7 +3,13 @@ module Types class TimeType < BaseScalar graphql_name 'Time' - description 'Time represented in ISO 8601' + description <<~DESC + Time represented in ISO 8601. + + For example: "2021-03-09T14:58:50+00:00". + + See `https://www.iso.org/iso-8601-date-and-time-format.html`. + DESC def self.coerce_input(value, ctx) Time.parse(value) diff --git a/app/models/alert_management/http_integration.rb b/app/models/alert_management/http_integration.rb index 2d9a2d7031c..e98c770c364 100644 --- a/app/models/alert_management/http_integration.rb +++ b/app/models/alert_management/http_integration.rb @@ -27,6 +27,7 @@ module AlertManagement before_validation :prevent_token_assignment before_validation :prevent_endpoint_identifier_assignment before_validation :ensure_token + before_validation :ensure_payload_example_not_nil scope :for_endpoint_identifier, -> (endpoint_identifier) { where(endpoint_identifier: endpoint_identifier) } scope :active, -> { where(active: true) } @@ -74,5 +75,9 @@ module AlertManagement self.endpoint_identifier = endpoint_identifier_was end end + + def ensure_payload_example_not_nil + self.payload_example ||= {} + end end end diff --git a/app/presenters/packages/detail/package_presenter.rb b/app/presenters/packages/detail/package_presenter.rb index dbfcfcb67f3..9960fb4bf12 100644 --- a/app/presenters/packages/detail/package_presenter.rb +++ b/app/presenters/packages/detail/package_presenter.rb @@ -42,7 +42,11 @@ module Packages created_at: package_file.created_at, download_path: package_file.download_path, file_name: package_file.file_name, - size: package_file.size + size: package_file.size, + file_md5: package_file.file_md5, + file_sha1: package_file.file_sha1, + file_sha256: package_file.file_sha256 + } file_view[:pipelines] = build_pipeline_infos(package_file.pipelines) if package_file.pipelines.present? diff --git a/app/views/projects/_merge_request_merge_checks_settings.html.haml b/app/views/projects/_merge_request_merge_checks_settings.html.haml index b099eb6800e..74b156f9b5e 100644 --- a/app/views/projects/_merge_request_merge_checks_settings.html.haml +++ b/app/views/projects/_merge_request_merge_checks_settings.html.haml @@ -2,26 +2,23 @@ .form-group %b= s_('ProjectSettings|Merge checks') - %p.text-secondary= s_('ProjectSettings|These checks must pass before merge requests can be merged') + %p.text-secondary= s_('ProjectSettings|These checks must pass before merge requests can be merged.') .form-check.mb-2.builds-feature = form.check_box :only_allow_merge_if_pipeline_succeeds, class: 'form-check-input' = form.label :only_allow_merge_if_pipeline_succeeds, class: 'form-check-label' do = s_('ProjectSettings|Pipelines must succeed') .text-secondary - = s_('ProjectSettings|Pipelines need to be configured to enable this feature.') - = link_to sprite_icon('question-o'), - help_page_path('ci/merge_request_pipelines/index.md', - anchor: 'pipelines-for-merge-requests'), - target: '_blank' + - configuring_pipelines_for_merge_requests_help_link_url = help_page_path('ci/merge_request_pipelines/index.md', anchor: 'configuring-pipelines-for-merge-requests') + - configuring_pipelines_for_merge_requests_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: configuring_pipelines_for_merge_requests_help_link_url } + = s_('ProjectSettings|To enable this feature, configure pipelines. %{link_start}How to configure pipelines for merge requests?%{link_end}').html_safe % { link_start: configuring_pipelines_for_merge_requests_help_link_start, link_end: '</a>'.html_safe } .form-check.mb-2 .gl-pl-6 = form.check_box :allow_merge_on_skipped_pipeline, class: 'form-check-input' = form.label :allow_merge_on_skipped_pipeline, class: 'form-check-label' do = s_('ProjectSettings|Skipped pipelines are considered successful') .text-secondary - = s_('ProjectSettings|This introduces the risk of merging changes that will not pass the pipeline.') + = s_('ProjectSettings|Introduces the risk of merging changes that do not pass the pipeline.') .form-check.mb-2 = form.check_box :only_allow_merge_if_all_discussions_are_resolved, class: 'form-check-input', data: { qa_selector: 'allow_merge_if_all_discussions_are_resolved_checkbox' } = form.label :only_allow_merge_if_all_discussions_are_resolved, class: 'form-check-label' do = s_('ProjectSettings|All discussions must be resolved') - = render_if_exists 'projects/merge_request_merge_checks_jira_enforcement', form: form, project: @project diff --git a/app/views/projects/_merge_request_merge_method_settings.html.haml b/app/views/projects/_merge_request_merge_method_settings.html.haml index cb3fcdef403..f55d840e14b 100644 --- a/app/views/projects/_merge_request_merge_method_settings.html.haml +++ b/app/views/projects/_merge_request_merge_method_settings.html.haml @@ -2,32 +2,32 @@ .form-group %b= s_('ProjectSettings|Merge method') - %p.text-secondary= s_('ProjectSettings|This will dictate the commit history when you merge a merge request') + %p.text-secondary= s_('ProjectSettings|Determine what happens to the commit history when you merge a merge request.') .form-check.mb-2 = form.radio_button :merge_method, :merge, class: "js-merge-method-radio form-check-input" = label_tag :project_merge_method_merge, class: 'form-check-label' do = s_('ProjectSettings|Merge commit') .text-secondary - = s_('ProjectSettings|Every merge creates a merge commit') + = s_('ProjectSettings|Every merge creates a merge commit.') .form-check.mb-2 = form.radio_button :merge_method, :rebase_merge, class: "js-merge-method-radio form-check-input" = label_tag :project_merge_method_rebase_merge, class: 'form-check-label' do = s_('ProjectSettings|Merge commit with semi-linear history') .text-secondary - = s_('ProjectSettings|Every merge creates a merge commit') + = s_('ProjectSettings|Every merge creates a merge commit.') %br - = s_('ProjectSettings|Fast-forward merges only') + = s_('ProjectSettings|Fast-forward merges only.') %br - = s_('ProjectSettings|When conflicts arise the user is given the option to rebase') + = s_('ProjectSettings|When there is a merge conflict, the user is given the option to rebase.') .form-check.mb-2 = form.radio_button :merge_method, :ff, class: "js-merge-method-radio form-check-input", data: { qa_selector: 'merge_ff_radio_button' } = label_tag :project_merge_method_ff, class: 'form-check-label' do = s_('ProjectSettings|Fast-forward merge') .text-secondary - = s_('ProjectSettings|No merge commits are created') + = s_('ProjectSettings|No merge commits are created.') %br - = s_('ProjectSettings|Fast-forward merges only') + = s_('ProjectSettings|Fast-forward merges only.') %br - = s_('ProjectSettings|When conflicts arise the user is given the option to rebase') + = s_('ProjectSettings|When there is a merge conflict, the user is given the option to rebase.') diff --git a/app/views/projects/_merge_request_merge_options_settings.html.haml b/app/views/projects/_merge_request_merge_options_settings.html.haml index 80dabeceeb0..20f3933d0a8 100644 --- a/app/views/projects/_merge_request_merge_options_settings.html.haml +++ b/app/views/projects/_merge_request_merge_options_settings.html.haml @@ -2,7 +2,7 @@ .form-group#project-merge-options{ data: { project_full_path: @project.full_path } } %b= s_('ProjectSettings|Merge options') - %p.text-secondary= s_('ProjectSettings|Additional merge request capabilities that influence how and when merges will be performed') + %p.text-secondary= s_('ProjectSettings|Additional settings that influence how and when merges are done.') = render_if_exists 'projects/merge_pipelines_settings', form: form = render_if_exists 'projects/merge_trains_settings', form: form .form-check.mb-2 @@ -12,10 +12,10 @@ .form-check.mb-2 = form.check_box :printing_merge_request_link_enabled, class: 'form-check-input' = form.label :printing_merge_request_link_enabled, class: 'form-check-label' do - = s_('ProjectSettings|Show link to create/view merge request when pushing from the command line') + = s_('ProjectSettings|Show link to create or view a merge request when pushing from the command line') .form-check.mb-2 = form.check_box :remove_source_branch_after_merge, class: 'form-check-input' = form.label :remove_source_branch_after_merge, class: 'form-check-label' do - = s_("ProjectSettings|Enable 'Delete source branch' option by default") + = s_('ProjectSettings|Enable "Delete source branch" option by default') .descr.text-secondary - = s_('ProjectSettings|Existing merge requests and protected branches are not affected') + = s_('ProjectSettings|Existing merge requests and protected branches are not affected.') diff --git a/app/views/projects/_merge_request_merge_suggestions_settings.html.haml b/app/views/projects/_merge_request_merge_suggestions_settings.html.haml index 31a85a204be..12ab905479a 100644 --- a/app/views/projects/_merge_request_merge_suggestions_settings.html.haml +++ b/app/views/projects/_merge_request_merge_suggestions_settings.html.haml @@ -3,15 +3,13 @@ .form-group %b= s_('ProjectSettings|Merge suggestions') %p.text-secondary - = s_('ProjectSettings|The commit message used to apply merge request suggestions') - = link_to sprite_icon('question-o'), - help_page_path('user/discussions/index.md', - anchor: 'configure-the-commit-message-for-applied-suggestions'), - target: '_blank' + - configure_the_commit_message_for_applied_suggestions_help_link_url = help_page_path('user/discussions/index.md', anchor: 'configure-the-commit-message-for-applied-suggestions') + - configure_the_commit_message_for_applied_suggestions_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: configure_the_commit_message_for_applied_suggestions_help_link_url } + = s_('ProjectSettings|The commit message used when applying merge request suggestions. %{link_start}Learn more about suggestions.%{link_end}').html_safe % { link_start: configure_the_commit_message_for_applied_suggestions_help_link_start, link_end: '</a>'.html_safe } .mb-2 - = form.text_field :suggestion_commit_message, class: 'form-control gl-form-input mb-2', placeholder: Gitlab::Suggestions::CommitMessage::DEFAULT_SUGGESTION_COMMIT_MESSAGE + = form.text_field :suggestion_commit_message, class: 'form-control mb-2', placeholder: Gitlab::Suggestions::CommitMessage::DEFAULT_SUGGESTION_COMMIT_MESSAGE %p.form-text.text-muted - = s_('ProjectSettings|The variables GitLab supports:') + = s_('ProjectSettings|Supported variables:') - Gitlab::Suggestions::CommitMessage::PLACEHOLDERS.keys.each do |placeholder| %code = "%{#{placeholder}}".html_safe diff --git a/app/views/projects/_merge_request_squash_options_settings.html.haml b/app/views/projects/_merge_request_squash_options_settings.html.haml index a5dbfeb16d8..61ffd4814f1 100644 --- a/app/views/projects/_merge_request_squash_options_settings.html.haml +++ b/app/views/projects/_merge_request_squash_options_settings.html.haml @@ -4,7 +4,7 @@ .form-group %b= s_('ProjectSettings|Squash commits when merging') %p.text-secondary - = s_('ProjectSettings|Set the default behavior and availability of this option in merge requests. Changes made are also applied to existing merge requests.') + = s_('ProjectSettings|Set the default behavior of this option in merge requests. Changes to this are also applied to existing merge requests.') = link_to "What is squashing?", help_page_path('user/project/merge_requests/squash_and_merge.md'), target: '_blank' diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index 049920e55c5..cba63d5e6d6 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -47,7 +47,7 @@ %td.line-numbers - (current_line...(current_line + line_count)).each do |i| - %a.diff-line-num{ href: "#L#{i}", id: "L#{i}", 'data-line-number' => i } + %a.diff-line-num.gl-justify-content-end{ href: "#L#{i}", id: "L#{i}", 'data-line-number' => i, class: "gl-display-flex!" } = link_icon = i \ |