Commit d8f2b0d5 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch...

Merge branch '298790-the-options-to-show-hide-the-open-and-closed-lists-in-boards-should-be-disabled-for-users' into 'master'

Disable board configuration options for users without edit permission

See merge request gitlab-org/gitlab!52077
parents f5df8529 ca45e81e
...@@ -14,6 +14,10 @@ export default { ...@@ -14,6 +14,10 @@ export default {
type: Boolean, type: Boolean,
required: true, required: true,
}, },
readonly: {
type: Boolean,
required: true,
},
}, },
}; };
</script> </script>
...@@ -28,12 +32,14 @@ export default { ...@@ -28,12 +32,14 @@ export default {
</p> </p>
<gl-form-checkbox <gl-form-checkbox
:checked="!hideBacklogList" :checked="!hideBacklogList"
:disabled="readonly"
data-testid="backlog-list-checkbox" data-testid="backlog-list-checkbox"
@change="$emit('update:hideBacklogList', !hideBacklogList)" @change="$emit('update:hideBacklogList', !hideBacklogList)"
>{{ __('Show the Open list') }} >{{ __('Show the Open list') }}
</gl-form-checkbox> </gl-form-checkbox>
<gl-form-checkbox <gl-form-checkbox
:checked="!hideClosedList" :checked="!hideClosedList"
:disabled="readonly"
data-testid="closed-list-checkbox" data-testid="closed-list-checkbox"
@change="$emit('update:hideClosedList', !hideClosedList)" @change="$emit('update:hideClosedList', !hideClosedList)"
>{{ __('Show the Closed list') }} >{{ __('Show the Closed list') }}
......
...@@ -308,6 +308,7 @@ export default { ...@@ -308,6 +308,7 @@ export default {
<board-configuration-options <board-configuration-options
:hide-backlog-list.sync="board.hide_backlog_list" :hide-backlog-list.sync="board.hide_backlog_list"
:hide-closed-list.sync="board.hide_closed_list" :hide-closed-list.sync="board.hide_closed_list"
:readonly="readonly"
/> />
<board-scope <board-scope
......
---
title: Disable board configuration options for users without edit permission
merge_request: 52077
author:
type: fixed
...@@ -7,6 +7,7 @@ describe('BoardConfigurationOptions', () => { ...@@ -7,6 +7,7 @@ describe('BoardConfigurationOptions', () => {
const defaultProps = { const defaultProps = {
hideBacklogList: false, hideBacklogList: false,
hideClosedList: false, hideClosedList: false,
readonly: false,
}; };
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
...@@ -61,4 +62,18 @@ describe('BoardConfigurationOptions', () => { ...@@ -61,4 +62,18 @@ describe('BoardConfigurationOptions', () => {
expect(wrapper.emitted('update:hideClosedList')).toEqual([[true]]); expect(wrapper.emitted('update:hideClosedList')).toEqual([[true]]);
}); });
it('renders checkboxes disabled when user does not have edit rights', () => {
createComponent({ readonly: true });
expect(closedListCheckbox().attributes('disabled')).toBe('true');
expect(backlogListCheckbox().attributes('disabled')).toBe('true');
});
it('renders checkboxes enabled when user has edit rights', () => {
createComponent();
expect(closedListCheckbox().attributes('disabled')).toBeUndefined();
expect(backlogListCheckbox().attributes('disabled')).toBeUndefined();
});
}); });
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