From 93f2849ea53bb6fa835ea03deeded1385334286f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 2 Feb 2022 03:17:34 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .markdownlint.yml | 2 + .../images/auth_buttons/atlassian_64.png | Bin 1512 -> 1364 bytes .../images/auth_buttons/facebook_64.png | Bin 870 -> 1033 bytes .../emoji/awards_app/store/actions.js | 41 +++++++++++++++--- doc/api/status_checks.md | 3 +- doc/integration/oauth_provider.md | 2 + .../maven_gradle_repository_spec.rb | 10 ++--- .../merge_request/user_awards_emoji_spec.rb | 1 + .../emoji/awards_app/store/actions_spec.js | 37 +++++++++++++--- 9 files changed, 79 insertions(+), 17 deletions(-) diff --git a/.markdownlint.yml b/.markdownlint.yml index e1e2b246314..7f71c933d96 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -139,6 +139,8 @@ proper-names: "unicorn-worker-killer", "URL", "WebdriverIO", + "Workload Identity Pool", + "Workload Identity Provider", "YAML", "YouTrack" ] diff --git a/app/assets/images/auth_buttons/atlassian_64.png b/app/assets/images/auth_buttons/atlassian_64.png index 548f1c9331870149e0915ce527f9ad4b9cac6abf..63169b9a81b2a7dea1a5e2705ae8c4218916a9ce 100644 GIT binary patch delta 1338 zcmV-A1;zU43)BjbD}NRx000&x0ZCFM@Bjb+0drDELIAGL9O(c600d`2O+f$vv5yP< zVFdsH1nEgcK~#7F?OMH#97PbWs-C?&64=lgRR862lX44}i1~AtA&WfkbF$2>W*0Roz`XbN1cs%uP?vT7RBTnwy@U+1u@}zWS=W zcL7F>7%^hRh!L+V5C+12Ve?f657EN(=?dO`RNxaB00aY}%%EWQZ*mCo9Rqh^APk}a zi9Qo>QtNv1^c1cSp@KmaAklxJYdVw)k}Kex=qmj-cqF+B(toA^!EEC*2zT!&d^>3HXi^mDWT=#JJe84>}X zEy{_Yn0&l+GeG9#7l?t#Du}0m(_I&RBEtu_m;`RWRRZ3Z+jt5;KpaF>L6j=6H~%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mPj1Z*8Eg@F-Ax0Dz)^$}Ljy+9)e1T=g% zLw{5gSQ+Ol>WAgO3hf(+jF8iwiiHYHe8Xkq8*66N)LR6)f`iNIi|nA4bq6i1EsV zc9Ayux*6v>ZS0eaw7IYqU!C0=-O|PprI)As56=oc!{f_u`Y%rh5K?AzeI5uXFoEmy iKtPWvx<3C~fB^uhxLy;GPBx+d0000;Fu delta 848 zcmV-W1F!sv2<8TmBYy)eNklU2K1`v-_)ZEc-B03*Lxy!*>>^bO5`ia7v7zc}m&&%*jT*aM(OhZ>oaR~ztb ziY|jEgacq45C_T6$57im3}tF^dJ#?Sqo}AKKxs|?6My6P-C>vtr4cgnkHr`Nox%9j z0u)tE%P_WwWx?ai1Jo=*+cWBkp}k5lt+0V_EPmL29_tED07Ij*_~4I|(DjO@-5X|N z1+Oh6fS-3=f}$#{?1k04NeZ^EAOT|V>u$vWS905+=N&`OVH4m|b_;YoqXY%O0XP5$ z-~b$eu7BG)UQsghmU9@s-Et0!>Rd(>UbPRQ=g1B96=q_M0HDF&?(>^EMrEe4Z3Ml8 zQ&3b>GmB_w8=>dOO~TO%IDC|<8H=JO0dcgxhZk9i$0}g^elqO^ngQ_9pDz}Gme6kx zoYy!!QnD6yW65MmT?(MwebT0V4O8 zz*3SZ<0QzyWpGPq26dL2)d|unj^|egWQJCRw}fOsQDqdi!~Vk*xvzEm`mcd=0qV+R zMc*eHzwAZ%6gUmqT0YzZ0P4rnz^OA2 aklz87SMK&hBOX%#0000 { } }; +/** + * Creates an intermediary award, used for display + * until the real award is loaded from the backend. + */ +const newOptimisticAward = (name, state) => { + const freeId = Math.min(...state.awards.map((a) => a.id), Number.MAX_SAFE_INTEGER) - 1; + return { + id: freeId, + name, + user: { + id: window.gon.current_user_id, + name: window.gon.current_user_fullname, + username: window.gon.current_username, + }, + }; +}; + export const toggleAward = async ({ commit, state }, name) => { const award = state.awards.find((a) => a.name === name && a.user.id === state.currentUserId); try { if (award) { - await axios.delete(joinPaths(gon.relative_url_root || '', `${state.path}/${award.id}`)); - commit(REMOVE_AWARD, award.id); + await axios + .delete(joinPaths(gon.relative_url_root || '', `${state.path}/${award.id}`)) + .catch((err) => { + commit(ADD_NEW_AWARD, award); + + throw err; + }); + showToast(__('Award removed')); } else { - const { data } = await axios.post(joinPaths(gon.relative_url_root || '', state.path), { - name, - }); + const optimisticAward = newOptimisticAward(name, state); + + commit(ADD_NEW_AWARD, optimisticAward); + + const { data } = await axios + .post(joinPaths(gon.relative_url_root || '', state.path), { + name, + }) + .finally(() => { + commit(REMOVE_AWARD, optimisticAward.id); + }); commit(ADD_NEW_AWARD, data); diff --git a/doc/api/status_checks.md b/doc/api/status_checks.md index e2849063475..0cded150474 100644 --- a/doc/api/status_checks.md +++ b/doc/api/status_checks.md @@ -31,7 +31,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/status_checks "id": 2, "name": "Rule 1", "external_url": "https://gitlab.com/test-endpoint", - "status": "approved" + "status": "pass" }, { "id": 1, @@ -60,6 +60,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/status_check_responses | `merge_request_iid` | integer | yes | IID of a merge request | | `sha` | string | yes | SHA at `HEAD` of the source branch | | `external_status_check_id` | integer | yes | ID of an external status check | +| `status` | string | no | Set to `pass` to pass the check | NOTE: `sha` must be the SHA at the `HEAD` of the merge request's source branch. diff --git a/doc/integration/oauth_provider.md b/doc/integration/oauth_provider.md index 373981c83e4..d091de09ee4 100644 --- a/doc/integration/oauth_provider.md +++ b/doc/integration/oauth_provider.md @@ -105,6 +105,8 @@ Existing: **Expire access tokens** to enable them. - Tokens must be [revoked](../api/oauth2.md#revoke-a-token) or they don't expire. +When applications are deleted, all grants and tokens associated with the application are also deleted. + ## Authorized applications Every application you authorize with your GitLab credentials is shown diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb index 908376ca2ca..45693ecee41 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb @@ -13,10 +13,10 @@ module QA let(:package_version) { '1.3.7' } let(:package_type) { 'maven_gradle' } - where(:authentication_token_type, :maven_header_name, :testcase) do - :personal_access_token | 'Private-Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347601' - :ci_job_token | 'Job-Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347603' - :project_deploy_token | 'Deploy-Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347602' + where(:case_name, :authentication_token_type, :maven_header_name, :testcase) do + 'using personal access token' | :personal_access_token | 'Private-Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347601' + 'using ci job token' | :ci_job_token | 'Job-Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347603' + 'using project deploy token' | :project_deploy_token | 'Deploy-Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347602' end with_them do @@ -31,7 +31,7 @@ module QA end end - it "pushes and pulls a maven package via gradle using #{params[:authentication_token_type]}", testcase: params[:testcase] do + it 'pushes and pulls a maven package via gradle', testcase: params[:testcase] do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| gradle_upload_yaml = ERB.new(read_fixture('package_managers/maven', 'gradle_upload_package.yaml.erb')).result(binding) diff --git a/spec/features/merge_request/user_awards_emoji_spec.rb b/spec/features/merge_request/user_awards_emoji_spec.rb index 240b8f996c8..35eadb34799 100644 --- a/spec/features/merge_request/user_awards_emoji_spec.rb +++ b/spec/features/merge_request/user_awards_emoji_spec.rb @@ -27,6 +27,7 @@ RSpec.describe 'Merge request > User awards emoji', :js do it 'removes award from merge request' do first('[data-testid="award-button"]').click + expect(first('[data-testid="award-button"]')).to have_content '1' find('[data-testid="award-button"].selected').click expect(first('[data-testid="award-button"]')).to have_content '0' diff --git a/spec/frontend/emoji/awards_app/store/actions_spec.js b/spec/frontend/emoji/awards_app/store/actions_spec.js index 02b643244d2..0761256ed23 100644 --- a/spec/frontend/emoji/awards_app/store/actions_spec.js +++ b/spec/frontend/emoji/awards_app/store/actions_spec.js @@ -87,6 +87,26 @@ describe('Awards app actions', () => { describe('toggleAward', () => { let mock; + const optimisticAwardId = Number.MAX_SAFE_INTEGER - 1; + const makeOptimisticAddMutation = ( + id = optimisticAwardId, + name = null, + userId = window.gon.current_user_id, + ) => ({ + type: 'ADD_NEW_AWARD', + payload: { + id, + name, + user: { + id: userId, + }, + }, + }); + const makeOptimisticRemoveMutation = (id = optimisticAwardId) => ({ + type: 'REMOVE_AWARD', + payload: id, + }); + beforeEach(() => { mock = new MockAdapter(axios); }); @@ -110,8 +130,10 @@ describe('Awards app actions', () => { mock.onPost(`${relativeRootUrl || ''}/awards`).reply(200, { id: 1 }); }); - it('commits ADD_NEW_AWARD', async () => { + it('adds an optimistic award, removes it, and then commits ADD_NEW_AWARD', async () => { testAction(actions.toggleAward, null, { path: '/awards', awards: [] }, [ + makeOptimisticAddMutation(), + makeOptimisticRemoveMutation(), { type: 'ADD_NEW_AWARD', payload: { id: 1 } }, ]); }); @@ -127,7 +149,7 @@ describe('Awards app actions', () => { actions.toggleAward, null, { path: '/awards', awards: [] }, - [], + [makeOptimisticAddMutation(), makeOptimisticRemoveMutation()], [], () => { expect(Sentry.captureException).toHaveBeenCalled(); @@ -137,7 +159,7 @@ describe('Awards app actions', () => { }); }); - describe('removing a award', () => { + describe('removing an award', () => { const mockData = { id: 1, name: 'thumbsup', user: { id: 1 } }; describe('success', () => { @@ -160,6 +182,9 @@ describe('Awards app actions', () => { }); describe('error', () => { + const currentUserId = 1; + const name = 'thumbsup'; + beforeEach(() => { mock.onDelete(`${relativeRootUrl || ''}/awards/1`).reply(500); }); @@ -167,13 +192,13 @@ describe('Awards app actions', () => { it('calls Sentry.captureException', async () => { await testAction( actions.toggleAward, - 'thumbsup', + name, { path: '/awards', - currentUserId: 1, + currentUserId, awards: [mockData], }, - [], + [makeOptimisticRemoveMutation(1), makeOptimisticAddMutation(1, name, currentUserId)], [], () => { expect(Sentry.captureException).toHaveBeenCalled();