Commit 3c4b9328 authored by Marcel van Remmerden's avatar Marcel van Remmerden Committed by Miguel Rincon

Show quick actions link when editing comments

This change fixes a bug where only "Markdown is supported" instead of
"Markdown" and "quick actions are supported" links are shown when
editing issue descriptions and comments

Changelog: fixed
parent 65144ab3
...@@ -170,7 +170,6 @@ export default { ...@@ -170,7 +170,6 @@ export default {
<note-form <note-form
v-if="diffFileCommentForm" v-if="diffFileCommentForm"
ref="noteForm" ref="noteForm"
:is-editing="false"
:save-button-title="__('Comment')" :save-button-title="__('Comment')"
class="diff-comment-form new-note discussion-form discussion-form-container" class="diff-comment-form new-note discussion-form discussion-form-container"
@handleFormUpdateAddToReview="addToReview" @handleFormUpdateAddToReview="addToReview"
......
...@@ -221,7 +221,6 @@ export default { ...@@ -221,7 +221,6 @@ export default {
</div> </div>
<note-form <note-form
ref="noteForm" ref="noteForm"
:is-editing="false"
:line-code="line.line_code" :line-code="line.line_code"
:line="line" :line="line"
:lines="commentLines" :lines="commentLines"
......
<script> <script>
import markdownField from '~/vue_shared/components/markdown/field.vue'; import markdownField from '~/vue_shared/components/markdown/field.vue';
import { helpPagePath } from '~/helpers/help_page_helper';
import updateMixin from '../../mixins/update'; import updateMixin from '../../mixins/update';
export default { export default {
...@@ -31,6 +32,11 @@ export default { ...@@ -31,6 +32,11 @@ export default {
default: true, default: true,
}, },
}, },
computed: {
quickActionsDocsPath() {
return helpPagePath('user/project/quick_actions');
},
},
mounted() { mounted() {
this.$refs.textarea.focus(); this.$refs.textarea.focus();
}, },
...@@ -43,6 +49,7 @@ export default { ...@@ -43,6 +49,7 @@ export default {
<markdown-field <markdown-field
:markdown-preview-path="markdownPreviewPath" :markdown-preview-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath" :markdown-docs-path="markdownDocsPath"
:quick-actions-docs-path="quickActionsDocsPath"
:can-attach-file="canAttachFile" :can-attach-file="canAttachFile"
:enable-autocomplete="enableAutocomplete" :enable-autocomplete="enableAutocomplete"
:textarea-value="formState.description" :textarea-value="formState.description"
......
...@@ -174,7 +174,6 @@ export default { ...@@ -174,7 +174,6 @@ export default {
<note-form <note-form
v-if="isEditing" v-if="isEditing"
ref="noteForm" ref="noteForm"
:is-editing="isEditing"
:note-body="noteBody" :note-body="noteBody"
:note-id="note.id" :note-id="note.id"
:line="line" :line="line"
......
...@@ -41,10 +41,6 @@ export default { ...@@ -41,10 +41,6 @@ export default {
required: false, required: false,
default: () => ({}), default: () => ({}),
}, },
isEditing: {
type: Boolean,
required: true,
},
lineCode: { lineCode: {
type: String, type: String,
required: false, required: false,
...@@ -184,7 +180,7 @@ export default { ...@@ -184,7 +180,7 @@ export default {
return this.getNotesDataByProp('markdownDocsPath'); return this.getNotesDataByProp('markdownDocsPath');
}, },
quickActionsDocsPath() { quickActionsDocsPath() {
return !this.isEditing ? this.getNotesDataByProp('quickActionsDocsPath') : undefined; return this.getNotesDataByProp('quickActionsDocsPath');
}, },
currentUserId() { currentUserId() {
return this.getUserDataByProp('id'); return this.getUserDataByProp('id');
...@@ -348,7 +344,7 @@ export default { ...@@ -348,7 +344,7 @@ export default {
ref="textarea" ref="textarea"
v-model="updatedNoteBody" v-model="updatedNoteBody"
:disabled="isSubmitting" :disabled="isSubmitting"
:data-supports-quick-actions="!isEditing" data-supports-quick-actions="true"
name="note[note]" name="note[note]"
class="note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form" class="note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form"
data-qa-selector="reply_field" data-qa-selector="reply_field"
......
...@@ -307,7 +307,6 @@ export default { ...@@ -307,7 +307,6 @@ export default {
v-if="isReplying" v-if="isReplying"
ref="noteForm" ref="noteForm"
:discussion="discussion" :discussion="discussion"
:is-editing="false"
:line="diffLine" :line="diffLine"
save-button-title="Comment" save-button-title="Comment"
:autosave-key="autosaveKey" :autosave-key="autosaveKey"
......
...@@ -14,6 +14,7 @@ describe('Description field component', () => { ...@@ -14,6 +14,7 @@ describe('Description field component', () => {
propsData: { propsData: {
markdownPreviewPath: '/', markdownPreviewPath: '/',
markdownDocsPath: '/', markdownDocsPath: '/',
quickActionsDocsPath: '/',
formState: { formState: {
description, description,
}, },
......
...@@ -81,7 +81,6 @@ describe('issue_note_form component', () => { ...@@ -81,7 +81,6 @@ describe('issue_note_form component', () => {
it('should show conflict message if note changes outside the component', async () => { it('should show conflict message if note changes outside the component', async () => {
wrapper.setProps({ wrapper.setProps({
...props, ...props,
isEditing: true,
noteBody: 'Foo', noteBody: 'Foo',
}); });
...@@ -111,6 +110,12 @@ describe('issue_note_form component', () => { ...@@ -111,6 +110,12 @@ describe('issue_note_form component', () => {
); );
}); });
it('should set data-supports-quick-actions to enable autocomplete', () => {
const textarea = wrapper.find('textarea');
expect(textarea.attributes('data-supports-quick-actions')).toBe('true');
});
it('should link to markdown docs', () => { it('should link to markdown docs', () => {
const { markdownDocsPath } = notesDataMock; const { markdownDocsPath } = notesDataMock;
const markdownField = wrapper.find(MarkdownField); const markdownField = wrapper.find(MarkdownField);
...@@ -171,7 +176,6 @@ describe('issue_note_form component', () => { ...@@ -171,7 +176,6 @@ describe('issue_note_form component', () => {
it('should be possible to cancel', async () => { it('should be possible to cancel', async () => {
wrapper.setProps({ wrapper.setProps({
...props, ...props,
isEditing: true,
}); });
await nextTick(); await nextTick();
...@@ -185,7 +189,6 @@ describe('issue_note_form component', () => { ...@@ -185,7 +189,6 @@ describe('issue_note_form component', () => {
it('should be possible to update the note', async () => { it('should be possible to update the note', async () => {
wrapper.setProps({ wrapper.setProps({
...props, ...props,
isEditing: true,
}); });
await nextTick(); await nextTick();
......
...@@ -86,7 +86,6 @@ describe('noteable_discussion component', () => { ...@@ -86,7 +86,6 @@ describe('noteable_discussion component', () => {
const noteFormProps = noteForm.props(); const noteFormProps = noteForm.props();
expect(noteFormProps.discussion).toBe(discussionMock); expect(noteFormProps.discussion).toBe(discussionMock);
expect(noteFormProps.isEditing).toBe(false);
expect(noteFormProps.line).toBe(null); expect(noteFormProps.line).toBe(null);
expect(noteFormProps.saveButtonTitle).toBe('Comment'); expect(noteFormProps.saveButtonTitle).toBe('Comment');
expect(noteFormProps.autosaveKey).toBe(`Note/Issue/${discussionMock.id}/Reply`); expect(noteFormProps.autosaveKey).toBe(`Note/Issue/${discussionMock.id}/Reply`);
......
...@@ -298,16 +298,18 @@ describe('note_app', () => { ...@@ -298,16 +298,18 @@ describe('note_app', () => {
await nextTick(); await nextTick();
expect(wrapper.find(`.edit-note a[href="${markdownDocsPath}"]`).text().trim()).toEqual( expect(wrapper.find(`.edit-note a[href="${markdownDocsPath}"]`).text().trim()).toEqual(
'Markdown is supported', 'Markdown',
); );
}); });
it('should not render quick actions docs url', async () => { it('should render quick actions docs url', async () => {
wrapper.find('.js-note-edit').trigger('click'); wrapper.find('.js-note-edit').trigger('click');
const { quickActionsDocsPath } = mockData.notesDataMock; const { quickActionsDocsPath } = mockData.notesDataMock;
await nextTick(); await nextTick();
expect(wrapper.find(`.edit-note a[href="${quickActionsDocsPath}"]`).exists()).toBe(false); expect(wrapper.find(`.edit-note a[href="${quickActionsDocsPath}"]`).text().trim()).toEqual(
'quick actions',
);
}); });
}); });
......
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