Commit eb533397 authored by Clement Ho's avatar Clement Ho Committed by Filipa Lacerda

Backport ability to enable/disable file attachments in issuable form

parent 3d67018c
...@@ -102,6 +102,11 @@ export default { ...@@ -102,6 +102,11 @@ export default {
required: false, required: false,
default: 'issue', default: 'issue',
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
data() { data() {
const store = new Store({ const store = new Store({
...@@ -234,6 +239,7 @@ export default { ...@@ -234,6 +239,7 @@ export default {
:project-path="projectPath" :project-path="projectPath"
:project-namespace="projectNamespace" :project-namespace="projectNamespace"
:show-delete-button="showDeleteButton" :show-delete-button="showDeleteButton"
:can-attach-file="canAttachFile"
/> />
<div v-else> <div v-else>
<title-component <title-component
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
type: String, type: String,
required: true, required: true,
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
components: { components: {
markdownField, markdownField,
...@@ -36,7 +41,8 @@ ...@@ -36,7 +41,8 @@
</label> </label>
<markdown-field <markdown-field
:markdown-preview-path="markdownPreviewPath" :markdown-preview-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath"> :markdown-docs-path="markdownDocsPath"
:can-attach-file="canAttachFile">
<textarea <textarea
id="issue-description" id="issue-description"
class="note-textarea js-gfm-input js-autosize markdown-area" class="note-textarea js-gfm-input js-autosize markdown-area"
......
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
required: false, required: false,
default: true, default: true,
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
components: { components: {
lockedWarning, lockedWarning,
...@@ -83,7 +88,8 @@ ...@@ -83,7 +88,8 @@
<description-field <description-field
:form-state="formState" :form-state="formState"
:markdown-preview-path="markdownPreviewPath" :markdown-preview-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath" /> :markdown-docs-path="markdownDocsPath"
:can-attach-file="canAttachFile" />
<edit-actions <edit-actions
:form-state="formState" :form-state="formState"
:can-destroy="canDestroy" :can-destroy="canDestroy"
......
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
type: String, type: String,
required: false, required: false,
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
data() { data() {
return { return {
...@@ -129,6 +134,7 @@ ...@@ -129,6 +134,7 @@
<markdown-toolbar <markdown-toolbar
:markdown-docs-path="markdownDocsPath" :markdown-docs-path="markdownDocsPath"
:quick-actions-docs-path="quickActionsDocsPath" :quick-actions-docs-path="quickActionsDocsPath"
:can-attach-file="canAttachFile"
/> />
</div> </div>
</div> </div>
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
type: String, type: String,
required: false, required: false,
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
}; };
</script> </script>
...@@ -41,7 +46,10 @@ ...@@ -41,7 +46,10 @@
are supported are supported
</template> </template>
</div> </div>
<span class="uploading-container"> <span
v-if="canAttachFile"
class="uploading-container"
>
<span class="uploading-progress-container hide"> <span class="uploading-progress-container hide">
<i <i
class="fa fa-file-image-o toolbar-button-icon" class="fa fa-file-image-o toolbar-button-icon"
......
import Vue from 'vue';
import toolbar from '~/vue_shared/components/markdown/toolbar.vue';
import mountComponent from '../../../helpers/vue_mount_component_helper';
describe('toolbar', () => {
let vm;
const Toolbar = Vue.extend(toolbar);
const props = {
markdownDocsPath: '',
};
afterEach(() => {
vm.$destroy();
});
describe('user can attach file', () => {
beforeEach(() => {
vm = mountComponent(Toolbar, props);
});
it('should render uploading-container', () => {
expect(vm.$el.querySelector('.uploading-container')).not.toBeNull();
});
});
describe('user cannot attach file', () => {
beforeEach(() => {
vm = mountComponent(Toolbar, Object.assign({}, props, {
canAttachFile: false,
}));
});
it('should not render uploading-container', () => {
expect(vm.$el.querySelector('.uploading-container')).toBeNull();
});
});
});
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