diff --git a/app/assets/javascripts/issues/show/components/header_actions.vue b/app/assets/javascripts/issues/show/components/header_actions.vue index fb662957006..43f00bbf771 100644 --- a/app/assets/javascripts/issues/show/components/header_actions.vue +++ b/app/assets/javascripts/issues/show/components/header_actions.vue @@ -180,7 +180,7 @@ export default { }); }, showLockIssueOption() { - return this.issueType === TYPE_ISSUE && this.isUserSignedIn; + return this.issueType === TYPE_ISSUE && this.isUserSignedIn && this.canUpdateIssue; }, showMovedSidebarOptions() { return this.isUserSignedIn; diff --git a/qa/qa/tools/ci/pipeline_creator.rb b/qa/qa/tools/ci/pipeline_creator.rb index 12b5179a7b0..d223a44dae2 100644 --- a/qa/qa/tools/ci/pipeline_creator.rb +++ b/qa/qa/tools/ci/pipeline_creator.rb @@ -160,7 +160,7 @@ module QA "FEATURE_FLAGS" => env["QA_FEATURE_FLAGS"], # QA_SUITES is only used by test-on-omnibus due to pipeline being reusable in external projects "QA_SUITES" => executable_qa_suites, - "QA_TESTS" => tests.join(" ") + "QA_TESTS" => tests&.join(" ") }.filter_map { |k, v| " #{k}: \"#{v}\"" unless v.blank? }.join("\n") "#{variables}#{vars}" diff --git a/spec/frontend/issues/show/components/header_actions_spec.js b/spec/frontend/issues/show/components/header_actions_spec.js index 6525c5dd40d..56d5362e5c2 100644 --- a/spec/frontend/issues/show/components/header_actions_spec.js +++ b/spec/frontend/issues/show/components/header_actions_spec.js @@ -139,6 +139,7 @@ describe('HeaderActions component', () => { const findCopyRefenceDropdownItem = () => wrapper.findByTestId('copy-reference'); const findCopyEmailItem = () => wrapper.findByTestId('copy-email'); const findPromoteToEpicButton = () => wrapper.findByTestId('promote-button'); + const findLockIssueToggle = () => wrapper.findByTestId('lock-issue-toggle'); const findModal = () => wrapper.findComponent(GlModal); @@ -344,6 +345,26 @@ describe('HeaderActions component', () => { }); }); + describe('Locking discussion', () => { + it.each` + description | canUpdateIssue | issueType | isLoggedIn | isExpected + ${'shows lock issue toggle when type is issue, user is signed in, and canUpdateIssue is true'} | ${true} | ${TYPE_ISSUE} | ${true} | ${true} + ${'does not show lock issue toggle if canUpdateIssue is false'} | ${false} | ${TYPE_ISSUE} | ${true} | ${false} + ${'does not show lock issue toggle if type is not issue'} | ${true} | ${TYPE_INCIDENT} | ${true} | ${false} + ${'does not show lock issue toggle if user is not signed in'} | ${true} | ${TYPE_ISSUE} | ${false} | ${false} + `('$description', ({ canUpdateIssue, issueType, isLoggedIn, isExpected }) => { + wrapper = mountComponent({ + isLoggedIn, + props: { + canUpdateIssue, + issueType, + }, + }); + + expect(findLockIssueToggle().exists()).toBe(isExpected); + }); + }); + describe('delete issue button', () => { let trackingSpy;