Commit b623c918 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'allow_collaboration_status_work' into 'master'

Update condition to visibility collaboration status text, #44642.

Closes #44642

See merge request gitlab-org/gitlab-ce!23104
parents bd268a1e 485b5beb
...@@ -106,6 +106,9 @@ export default { ...@@ -106,6 +106,9 @@ export default {
(!this.mr.isNothingToMergeState && !this.mr.isMergedState) (!this.mr.isNothingToMergeState && !this.mr.isMergedState)
); );
}, },
shouldRenderCollaborationStatus() {
return this.mr.allowCollaboration && this.mr.isOpen;
},
shouldRenderMergedPipeline() { shouldRenderMergedPipeline() {
return this.mr.state === 'merged' && !_.isEmpty(this.mr.mergePipeline); return this.mr.state === 'merged' && !_.isEmpty(this.mr.mergePipeline);
}, },
...@@ -315,7 +318,7 @@ export default { ...@@ -315,7 +318,7 @@ export default {
<div class="mr-widget-section"> <div class="mr-widget-section">
<component :is="componentName" :mr="mr" :service="service" /> <component :is="componentName" :mr="mr" :service="service" />
<section v-if="mr.allowCollaboration" class="mr-info-list mr-links"> <section v-if="shouldRenderCollaborationStatus" class="mr-info-list mr-links">
{{ s__('mrWidget|Allows commits from members who can merge to the target branch') }} {{ s__('mrWidget|Allows commits from members who can merge to the target branch') }}
</section> </section>
......
---
title: Update a condition to visibility a merge request collaboration message
merge_request: 23104
author: Harry Kiselev
type: other
...@@ -18,6 +18,8 @@ describe('mrWidgetOptions', () => { ...@@ -18,6 +18,8 @@ describe('mrWidgetOptions', () => {
let vm; let vm;
let MrWidgetOptions; let MrWidgetOptions;
const COLLABORATION_MESSAGE = 'Allows commits from members who can merge to the target branch';
beforeEach(() => { beforeEach(() => {
// Prevent component mounting // Prevent component mounting
delete mrWidgetOptions.el; delete mrWidgetOptions.el;
...@@ -132,6 +134,53 @@ describe('mrWidgetOptions', () => { ...@@ -132,6 +134,53 @@ describe('mrWidgetOptions', () => {
expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false); expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false);
}); });
}); });
describe('shouldRenderCollaborationStatus', () => {
describe('when collaboration is allowed', () => {
beforeEach(() => {
vm.mr.allowCollaboration = true;
});
describe('when merge request is opened', () => {
beforeEach(done => {
vm.mr.isOpen = true;
vm.$nextTick(done);
});
it('should render collaboration status', () => {
expect(vm.$el.textContent).toContain(COLLABORATION_MESSAGE);
});
});
describe('when merge request is not opened', () => {
beforeEach(done => {
vm.mr.isOpen = false;
vm.$nextTick(done);
});
it('should not render collaboration status', () => {
expect(vm.$el.textContent).not.toContain(COLLABORATION_MESSAGE);
});
});
});
describe('when collaboration is not allowed', () => {
beforeEach(() => {
vm.mr.allowCollaboration = false;
});
describe('when merge request is opened', () => {
beforeEach(done => {
vm.mr.isOpen = true;
vm.$nextTick(done);
});
it('should not render collaboration status', () => {
expect(vm.$el.textContent).not.toContain(COLLABORATION_MESSAGE);
});
});
});
});
}); });
describe('methods', () => { describe('methods', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment