From bd02c91f731fd4a02fd44f72b06f6e5f33625065 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 9 Jun 2021 03:10:22 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/CODEOWNERS | 2 ++ .../grouped_codequality_reports_app.vue | 16 +++++++++++ .../codequality_report/store/mutations.js | 3 ++ .../mr_widget_options.vue | 3 ++ doc/api/graphql/reference/index.md | 6 ++++ doc/api/users.md | 28 +++++++++++++++++-- .../documentation/styleguide/index.md | 9 +----- .../documentation/styleguide/word_list.md | 4 +++ doc/development/documentation/testing.md | 13 ++++++++- doc/policy/maintenance.md | 18 ++++++------ lib/api/users.rb | 8 ++++++ .../codequality_report/store/actions_spec.js | 3 ++ .../store/mutations_spec.js | 9 ++++++ spec/requests/api/users_spec.rb | 23 +++++++++++++++ 14 files changed, 125 insertions(+), 20 deletions(-) diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 56fe593c94d..9a1282e65f0 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -7,6 +7,8 @@ *.rake @gitlab-org/maintainers/rails-backend [Documentation Directories] +.markdownlint.yml @marcel.amirault @eread @aqualls @cnorris +/doc/.markdownlint @marcel.amirault @eread @aqualls @cnorris /doc/ @gl-docsteam /doc/.vale/ @marcel.amirault @eread @aqualls @cnorris /doc/administration/geo/ @axil diff --git a/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue b/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue index 3287ba691bf..e568950380e 100644 --- a/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue +++ b/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue @@ -12,11 +12,24 @@ export default { ReportSection, }, props: { + headPath: { + type: String, + required: true, + }, + headBlobPath: { + type: String, + required: true, + }, basePath: { type: String, required: false, default: null, }, + baseBlobPath: { + type: String, + required: false, + default: null, + }, codequalityReportsPath: { type: String, required: false, @@ -40,6 +53,9 @@ export default { created() { this.setPaths({ basePath: this.basePath, + headPath: this.headPath, + baseBlobPath: this.baseBlobPath, + headBlobPath: this.headBlobPath, reportsPath: this.codequalityReportsPath, helpPath: this.codequalityHelpPath, }); diff --git a/app/assets/javascripts/reports/codequality_report/store/mutations.js b/app/assets/javascripts/reports/codequality_report/store/mutations.js index 8edeb6cc976..095e6637966 100644 --- a/app/assets/javascripts/reports/codequality_report/store/mutations.js +++ b/app/assets/javascripts/reports/codequality_report/store/mutations.js @@ -3,6 +3,9 @@ import * as types from './mutation_types'; export default { [types.SET_PATHS](state, paths) { state.basePath = paths.basePath; + state.headPath = paths.headPath; + state.baseBlobPath = paths.baseBlobPath; + state.headBlobPath = paths.headBlobPath; state.reportsPath = paths.reportsPath; state.helpPath = paths.helpPath; }, diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue index daaca62140c..e9dcf494099 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue +++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue @@ -497,6 +497,9 @@ export default { diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 04946224c09..e9df5857695 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -9548,6 +9548,8 @@ Returns [`VulnerabilitySeveritiesCount`](#vulnerabilityseveritiescount). | Name | Type | Description | | ---- | ---- | ----------- | +| `hasIssues` | [`Boolean`](#boolean) | Filter vulnerabilities that do or do not have issues. | +| `hasResolution` | [`Boolean`](#boolean) | Filter vulnerabilities that do or do not have a resolution. | | `projectId` | [`[ID!]`](#id) | Filter vulnerabilities by project. | | `reportType` | [`[VulnerabilityReportType!]`](#vulnerabilityreporttype) | Filter vulnerabilities by report type. | | `scanner` | [`[String!]`](#string) | Filter vulnerabilities by scanner. | @@ -9717,6 +9719,8 @@ Returns [`VulnerabilitySeveritiesCount`](#vulnerabilityseveritiescount). | Name | Type | Description | | ---- | ---- | ----------- | +| `hasIssues` | [`Boolean`](#boolean) | Filter vulnerabilities that do or do not have issues. | +| `hasResolution` | [`Boolean`](#boolean) | Filter vulnerabilities that do or do not have a resolution. | | `projectId` | [`[ID!]`](#id) | Filter vulnerabilities by project. | | `reportType` | [`[VulnerabilityReportType!]`](#vulnerabilityreporttype) | Filter vulnerabilities by report type. | | `scanner` | [`[String!]`](#string) | Filter vulnerabilities by scanner. | @@ -11954,6 +11958,8 @@ Returns [`VulnerabilitySeveritiesCount`](#vulnerabilityseveritiescount). | Name | Type | Description | | ---- | ---- | ----------- | +| `hasIssues` | [`Boolean`](#boolean) | Filter vulnerabilities that do or do not have issues. | +| `hasResolution` | [`Boolean`](#boolean) | Filter vulnerabilities that do or do not have a resolution. | | `projectId` | [`[ID!]`](#id) | Filter vulnerabilities by project. | | `reportType` | [`[VulnerabilityReportType!]`](#vulnerabilityreporttype) | Filter vulnerabilities by report type. | | `scanner` | [`[String!]`](#string) | Filter vulnerabilities by scanner. | diff --git a/doc/api/users.md b/doc/api/users.md index 3396b3fab38..0e7b197b106 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -453,7 +453,6 @@ Parameters: | `twitter` | No | Twitter account | | `username` | Yes | Username | | `view_diffs_file_by_file` | No | Flag indicating the user sees only one file diff per page | -| `show_whitespace_in_diffs` | No | Flag indicating the user sees whitespace changes in diffs | `website_url` | No | Website URL | ## User modification @@ -694,6 +693,29 @@ Example response: } ``` +## Get user preferences + +Get a list of currently authenticated user's preferences. + +```plaintext +GET /user/preferences +``` + +Example response: + +```json +{ + "id": 1, + "user_id": 1 + "view_diffs_file_by_file": true, + "show_whitespace_in_diffs": false +} +``` + +Parameters: + +- **none** + ## User preference modification Update the current user's preferences. @@ -706,7 +728,8 @@ PUT /user/preferences { "id": 1, "user_id": 1 - "view_diffs_file_by_file": true + "view_diffs_file_by_file": true, + "show_whitespace_in_diffs": false } ``` @@ -715,6 +738,7 @@ Parameters: | Attribute | Required | Description | | :--------------------------- | :------- | :---------------------------------------------------------- | | `view_diffs_file_by_file` | Yes | Flag indicating the user sees only one file diff per page. | +| `show_whitespace_in_diffs` | Yes | Flag indicating the user sees whitespace changes in diffs. | ## Set user status diff --git a/doc/development/documentation/styleguide/index.md b/doc/development/documentation/styleguide/index.md index 50db8509882..74e9eca443a 100644 --- a/doc/development/documentation/styleguide/index.md +++ b/doc/development/documentation/styleguide/index.md @@ -306,13 +306,6 @@ GitLab documentation should be clear and easy to understand. - Write in US English with US grammar. (Tested in [`British.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/British.yml).) - Use [inclusive language](#inclusive-language). -### Trademark - -Only use the GitLab name and trademarks in accordance with -[GitLab Brand Guidelines](https://about.gitlab.com/handbook/marketing/corporate-marketing/brand-activation/brand-guidelines/#trademark). - -Don't use the possessive form of the word GitLab (`GitLab's`). - ### Capitalization #### Headings @@ -508,7 +501,7 @@ especially in tutorials, instructional documentation, and Some contractions, however, should be avoided: -- Do not use [the word GitLab in a contraction](#trademark). +- Do not use the word "GitLab" in a contraction. - Do not use contractions with a proper noun and a verb. For example: diff --git a/doc/development/documentation/styleguide/word_list.md b/doc/development/documentation/styleguide/word_list.md index 5255267f9c8..ce10b11e90a 100644 --- a/doc/development/documentation/styleguide/word_list.md +++ b/doc/development/documentation/styleguide/word_list.md @@ -48,6 +48,10 @@ Do not use Latin abbreviations. Use **for example**, **such as**, **for instance When possible, use present tense instead. For example, use `after you execute this command, GitLab displays the result` instead of `after you execute this command, GitLab will display the result`. ([Vale](../testing.md#vale) rule: [`FutureTense.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/FutureTense.yml)) +## GitLab + +Do not make possessive (GitLab's). This guidance follows [GitLab Brand Guidelines](https://about.gitlab.com/handbook/marketing/corporate-marketing/brand-activation/brand-guidelines/#trademark). + ## handy Do not use. If the user doesn't find the process to be these things, we lose their trust. diff --git a/doc/development/documentation/testing.md b/doc/development/documentation/testing.md index 6764a38b2cc..b634e2b93db 100644 --- a/doc/development/documentation/testing.md +++ b/doc/development/documentation/testing.md @@ -330,7 +330,18 @@ document: - To disable all Vale linting rules, add a `` tag before the text, and a `` tag after the text. -Whenever possible, exclude only the problematic rule and line(s). +Whenever possible, exclude only the problematic rule and lines. For more information, see [Vale's documentation](https://docs.errata.ai/vale/scoping#markup-based-configuration). + +### Disable markdownlint tests + +To disable all markdownlint rules, add a `` tag before the text, and a +`` tag after the text. + +To disable only a [specific rule](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#rules), +add the rule number to the tag, for example `` +and ``. + +Whenever possible, exclude only the problematic lines. diff --git a/doc/policy/maintenance.md b/doc/policy/maintenance.md index a49d26b6c64..d8b36fcaa6d 100644 --- a/doc/policy/maintenance.md +++ b/doc/policy/maintenance.md @@ -24,10 +24,10 @@ releases](#backporting-to-older-releases) for more information. GitLab uses [Semantic Versioning](https://semver.org/) for its releases: `(Major).(Minor).(Patch)`. -For example, for GitLab version 12.10.6: +For example, for GitLab version 13.10.6: -- `12` represents the major version. The major release was 12.0.0 but often referred to as 12.0. -- `10` represents the minor version. The minor release was 12.10.0 but often referred to as 12.10. +- `13` represents the major version. The major release was 13.0.0 but often referred to as 13.0. +- `10` represents the minor version. The minor release was 13.10.0 but often referred to as 13.10. - `6` represents the patch number. Any part of the version number can increment into multiple digits, for example, 13.10.11. @@ -55,13 +55,13 @@ one major version. For example, it is safe to: - Upgrade the *minor* version. For example: - - `12.7.5` -> `12.10.5` - - `11.3.4` -> `11.11.1` + - `13.7.5` -> `13.10.5` + - `12.3.4` -> `12.10.11` - Upgrade the *patch* version. For example: - - `12.0.4` -> `12.0.12` - - `11.11.1` -> `11.11.8` + - `13.0.4` -> `13.0.12` + - `12.10.1` -> `12.10.8` NOTE: Version specific changes in Omnibus GitLab Linux packages can be found in [the Omnibus GitLab documentation](https://docs.gitlab.com/omnibus/update/README.html#version-specific-changes). @@ -131,8 +131,8 @@ based on *all* of the following: If *all* of the above are satisfied, the backport releases can be created for the current stable release, and two previous monthly releases. In rare cases a release manager may grant an exception to backport to more than two previous monthly releases. -For instance, if we release `11.2.1` with a fix for a severe bug introduced in -`11.0.0`, we could backport the fix to a new `11.0.x`, and `11.1.x` patch release. +For instance, if we release `13.2.1` with a fix for a severe bug introduced in +`13.0.0`, we could backport the fix to a new `13.0.x`, and `13.1.x` patch release. To request backporting to more than one stable release for consideration, raise an issue in the [release/tasks](https://gitlab.com/gitlab-org/release/tasks/-/issues/new?issuable_template=Backporting-request) issue tracker. diff --git a/lib/api/users.rb b/lib/api/users.rb index 3dbc6b4ee0d..2608fb87e22 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -1045,6 +1045,14 @@ module API end end + desc "Get the current user's preferences" do + success Entities::UserPreferences + detail 'This feature was introduced in GitLab 14.0.' + end + get "preferences", feature_category: :users do + present current_user.user_preference, with: Entities::UserPreferences + end + desc 'Get a single email address owned by the currently authenticated user' do success Entities::Email end diff --git a/spec/frontend/reports/codequality_report/store/actions_spec.js b/spec/frontend/reports/codequality_report/store/actions_spec.js index 1b83d071d17..9dda024bffd 100644 --- a/spec/frontend/reports/codequality_report/store/actions_spec.js +++ b/spec/frontend/reports/codequality_report/store/actions_spec.js @@ -20,6 +20,9 @@ describe('Codequality Reports actions', () => { it('should commit SET_PATHS mutation', (done) => { const paths = { basePath: 'basePath', + headPath: 'headPath', + baseBlobPath: 'baseBlobPath', + headBlobPath: 'headBlobPath', reportsPath: 'reportsPath', helpPath: 'codequalityHelpPath', }; diff --git a/spec/frontend/reports/codequality_report/store/mutations_spec.js b/spec/frontend/reports/codequality_report/store/mutations_spec.js index 9d4c05afd36..8bc6bb26c2a 100644 --- a/spec/frontend/reports/codequality_report/store/mutations_spec.js +++ b/spec/frontend/reports/codequality_report/store/mutations_spec.js @@ -13,16 +13,25 @@ describe('Codequality Reports mutations', () => { describe('SET_PATHS', () => { it('sets paths to given values', () => { const basePath = 'base.json'; + const headPath = 'head.json'; + const baseBlobPath = 'base/blob/path/'; + const headBlobPath = 'head/blob/path/'; const reportsPath = 'reports.json'; const helpPath = 'help.html'; mutations.SET_PATHS(localState, { basePath, + headPath, + baseBlobPath, + headBlobPath, reportsPath, helpPath, }); expect(localState.basePath).toEqual(basePath); + expect(localState.headPath).toEqual(headPath); + expect(localState.baseBlobPath).toEqual(baseBlobPath); + expect(localState.headBlobPath).toEqual(headBlobPath); expect(localState.reportsPath).toEqual(reportsPath); expect(localState.helpPath).toEqual(helpPath); }); diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 71fdd986f20..a9231b65c8f 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -2077,6 +2077,29 @@ RSpec.describe API::Users do it_behaves_like 'get user info', 'v4' end + describe "GET /user/preferences" do + context "when unauthenticated" do + it "returns authentication error" do + get api("/user/preferences") + expect(response).to have_gitlab_http_status(:unauthorized) + end + end + + context "when authenticated" do + it "returns user preferences" do + user.user_preference.view_diffs_file_by_file = false + user.user_preference.show_whitespace_in_diffs = true + user.save! + + get api("/user/preferences", user) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response["view_diffs_file_by_file"]).to eq(user.user_preference.view_diffs_file_by_file) + expect(json_response["show_whitespace_in_diffs"]).to eq(user.user_preference.show_whitespace_in_diffs) + end + end + end + describe "GET /user/keys" do context "when unauthenticated" do it "returns authentication error" do