2017-06-23 11:42:08 -04:00
|
|
|
<script>
|
2018-03-16 16:16:21 -04:00
|
|
|
import $ from 'jquery';
|
|
|
|
import { mapActions, mapGetters, mapState } from 'vuex';
|
2020-02-07 16:08:39 -05:00
|
|
|
import { isEmpty } from 'lodash';
|
2018-03-16 16:16:21 -04:00
|
|
|
import Autosize from 'autosize';
|
2020-04-21 11:21:10 -04:00
|
|
|
import { GlAlert, GlIntersperse, GlLink, GlSprintf } from '@gitlab/ui';
|
2018-03-16 16:16:21 -04:00
|
|
|
import { __, sprintf } from '~/locale';
|
2018-11-29 08:54:40 -05:00
|
|
|
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
|
2018-03-16 16:16:21 -04:00
|
|
|
import Flash from '../../flash';
|
|
|
|
import Autosave from '../../autosave';
|
2018-10-05 05:00:55 -04:00
|
|
|
import {
|
|
|
|
capitalizeFirstCharacter,
|
|
|
|
convertToCamelCase,
|
|
|
|
splitCamelCase,
|
2019-04-12 11:32:24 -04:00
|
|
|
slugifyWithUnderscore,
|
2018-10-05 05:00:55 -04:00
|
|
|
} from '../../lib/utils/text_utility';
|
2019-07-09 04:44:19 -04:00
|
|
|
import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests';
|
2018-03-16 16:16:21 -04:00
|
|
|
import * as constants from '../constants';
|
|
|
|
import eventHub from '../event_hub';
|
|
|
|
import issueWarning from '../../vue_shared/components/issue/issue_warning.vue';
|
|
|
|
import markdownField from '../../vue_shared/components/markdown/field.vue';
|
|
|
|
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
|
|
|
|
import loadingButton from '../../vue_shared/components/loading_button.vue';
|
|
|
|
import noteSignedOutWidget from './note_signed_out_widget.vue';
|
|
|
|
import discussionLockedWidget from './discussion_locked_widget.vue';
|
|
|
|
import issuableStateMixin from '../mixins/issuable_state';
|
2017-06-23 11:42:08 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
export default {
|
|
|
|
name: 'CommentForm',
|
|
|
|
components: {
|
|
|
|
issueWarning,
|
|
|
|
noteSignedOutWidget,
|
|
|
|
discussionLockedWidget,
|
|
|
|
markdownField,
|
|
|
|
userAvatarLink,
|
|
|
|
loadingButton,
|
2018-11-29 08:54:40 -05:00
|
|
|
TimelineEntryItem,
|
2020-04-21 11:21:10 -04:00
|
|
|
GlAlert,
|
|
|
|
GlIntersperse,
|
|
|
|
GlLink,
|
|
|
|
GlSprintf,
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
mixins: [issuableStateMixin],
|
|
|
|
props: {
|
|
|
|
noteableType: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2018-01-04 19:18:35 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
note: '',
|
|
|
|
noteType: constants.COMMENT,
|
|
|
|
isSubmitting: false,
|
|
|
|
isSubmitButtonDisabled: true,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'getCurrentUserLastNote',
|
|
|
|
'getUserData',
|
|
|
|
'getNoteableData',
|
|
|
|
'getNotesData',
|
|
|
|
'openState',
|
2020-04-21 11:21:10 -04:00
|
|
|
'getBlockedByIssues',
|
2018-03-16 16:16:21 -04:00
|
|
|
]),
|
2020-04-21 11:21:10 -04:00
|
|
|
...mapState(['isToggleStateButtonLoading', 'isToggleBlockedIssueWarning']),
|
2018-03-16 16:16:21 -04:00
|
|
|
noteableDisplayName() {
|
2018-06-21 08:22:40 -04:00
|
|
|
return splitCamelCase(this.noteableType).toLowerCase();
|
2018-02-27 19:10:43 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
isLoggedIn() {
|
|
|
|
return this.getUserData.id;
|
|
|
|
},
|
|
|
|
commentButtonTitle() {
|
2019-07-04 06:20:38 -04:00
|
|
|
return this.noteType === constants.COMMENT ? __('Comment') : __('Start thread');
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
|
|
|
startDiscussionDescription() {
|
2019-07-04 06:20:38 -04:00
|
|
|
return this.getNoteableData.noteableType === constants.MERGE_REQUEST_NOTEABLE_TYPE
|
|
|
|
? __('Discuss a specific suggestion or question that needs to be resolved.')
|
|
|
|
: __('Discuss a specific suggestion or question.');
|
2017-06-23 11:42:08 -04:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
isOpen() {
|
2018-06-21 08:22:40 -04:00
|
|
|
return this.openState === constants.OPENED || this.openState === constants.REOPENED;
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
canCreateNote() {
|
|
|
|
return this.getNoteableData.current_user.can_create_note;
|
|
|
|
},
|
|
|
|
issueActionButtonTitle() {
|
|
|
|
const openOrClose = this.isOpen ? 'close' : 'reopen';
|
2017-06-23 11:42:08 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
if (this.note.length) {
|
|
|
|
return sprintf(__('%{actionText} & %{openOrClose} %{noteable}'), {
|
|
|
|
actionText: this.commentButtonTitle,
|
|
|
|
openOrClose,
|
|
|
|
noteable: this.noteableDisplayName,
|
|
|
|
});
|
|
|
|
}
|
2017-06-23 11:42:08 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
return sprintf(__('%{openOrClose} %{noteable}'), {
|
|
|
|
openOrClose: capitalizeFirstCharacter(openOrClose),
|
|
|
|
noteable: this.noteableDisplayName,
|
|
|
|
});
|
2017-07-18 16:08:26 -04:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
actionButtonClassNames() {
|
|
|
|
return {
|
|
|
|
'btn-reopen': !this.isOpen,
|
|
|
|
'btn-close': this.isOpen,
|
|
|
|
'js-note-target-close': this.isOpen,
|
|
|
|
'js-note-target-reopen': !this.isOpen,
|
|
|
|
};
|
2018-01-04 19:18:35 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
markdownDocsPath() {
|
|
|
|
return this.getNotesData.markdownDocsPath;
|
|
|
|
},
|
|
|
|
quickActionsDocsPath() {
|
|
|
|
return this.getNotesData.quickActionsDocsPath;
|
|
|
|
},
|
|
|
|
markdownPreviewPath() {
|
|
|
|
return this.getNoteableData.preview_note_path;
|
|
|
|
},
|
|
|
|
author() {
|
|
|
|
return this.getUserData;
|
|
|
|
},
|
2019-04-03 11:26:03 -04:00
|
|
|
canToggleIssueState() {
|
|
|
|
return (
|
|
|
|
this.getNoteableData.current_user.can_update &&
|
|
|
|
this.getNoteableData.state !== constants.MERGED
|
|
|
|
);
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
endpoint() {
|
|
|
|
return this.getNoteableData.create_note_path;
|
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
issuableTypeTitle() {
|
2018-10-05 05:00:55 -04:00
|
|
|
return this.noteableType === constants.MERGE_REQUEST_NOTEABLE_TYPE
|
2019-07-04 06:20:38 -04:00
|
|
|
? __('merge request')
|
|
|
|
: __('issue');
|
2018-06-21 08:22:40 -04:00
|
|
|
},
|
2019-04-12 11:32:24 -04:00
|
|
|
trackingLabel() {
|
|
|
|
return slugifyWithUnderscore(`${this.commentButtonTitle} button`);
|
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
note(newNote) {
|
|
|
|
this.setIsSubmitButtonDisabled(newNote, this.isSubmitting);
|
|
|
|
},
|
|
|
|
isSubmitting(newValue) {
|
|
|
|
this.setIsSubmitButtonDisabled(this.note, newValue);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
// jQuery is needed here because it is a custom event being dispatched with jQuery.
|
|
|
|
$(document).on('issuable:change', (e, isClosed) => {
|
2018-06-21 08:22:40 -04:00
|
|
|
this.toggleIssueLocalState(isClosed ? constants.CLOSED : constants.REOPENED);
|
2018-03-16 16:16:21 -04:00
|
|
|
});
|
2018-01-04 19:18:35 -05:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
this.initAutoSave();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions([
|
|
|
|
'saveNote',
|
|
|
|
'stopPolling',
|
|
|
|
'restartPolling',
|
|
|
|
'removePlaceholderNotes',
|
|
|
|
'closeIssue',
|
|
|
|
'reopenIssue',
|
|
|
|
'toggleIssueLocalState',
|
|
|
|
'toggleStateButtonLoading',
|
2020-04-21 11:21:10 -04:00
|
|
|
'toggleBlockedIssueWarning',
|
2018-03-16 16:16:21 -04:00
|
|
|
]),
|
|
|
|
setIsSubmitButtonDisabled(note, isSubmitting) {
|
2020-02-07 16:08:39 -05:00
|
|
|
if (!isEmpty(note) && !isSubmitting) {
|
2018-03-16 16:16:21 -04:00
|
|
|
this.isSubmitButtonDisabled = false;
|
|
|
|
} else {
|
|
|
|
this.isSubmitButtonDisabled = true;
|
|
|
|
}
|
2018-01-04 19:18:35 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
handleSave(withIssueAction) {
|
|
|
|
this.isSubmitting = true;
|
2018-02-12 11:49:41 -05:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
if (this.note.length) {
|
|
|
|
const noteData = {
|
|
|
|
endpoint: this.endpoint,
|
|
|
|
flashContainer: this.$el,
|
|
|
|
data: {
|
|
|
|
note: {
|
|
|
|
noteable_type: this.noteableType,
|
|
|
|
noteable_id: this.getNoteableData.id,
|
|
|
|
note: this.note,
|
2017-06-29 07:47:59 -04:00
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
merge_request_diff_head_sha: this.getNoteableData.diff_head_sha,
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
};
|
2017-06-23 11:42:08 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
if (this.noteType === constants.DISCUSSION) {
|
|
|
|
noteData.data.note.type = constants.DISCUSSION_NOTE;
|
|
|
|
}
|
2018-03-12 13:08:05 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
this.note = ''; // Empty textarea while being requested. Repopulate in catch
|
|
|
|
this.resizeTextarea();
|
|
|
|
this.stopPolling();
|
2017-08-02 11:44:01 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
this.saveNote(noteData)
|
2019-12-12 19:08:05 -05:00
|
|
|
.then(() => {
|
2018-03-16 16:16:21 -04:00
|
|
|
this.enableButton();
|
|
|
|
this.restartPolling();
|
2019-12-12 19:08:05 -05:00
|
|
|
this.discard();
|
2017-08-21 14:20:44 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
if (withIssueAction) {
|
|
|
|
this.toggleIssueState();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
this.enableButton();
|
|
|
|
this.discard(false);
|
2019-07-04 06:20:38 -04:00
|
|
|
const msg = __(
|
|
|
|
'Your comment could not be submitted! Please check your network connection and try again.',
|
|
|
|
);
|
2018-03-16 16:16:21 -04:00
|
|
|
Flash(msg, 'alert', this.$el);
|
|
|
|
this.note = noteData.data.note.note; // Restore textarea content.
|
|
|
|
this.removePlaceholderNotes();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.toggleIssueState();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
enableButton() {
|
|
|
|
this.isSubmitting = false;
|
|
|
|
},
|
|
|
|
toggleIssueState() {
|
2020-04-21 11:21:10 -04:00
|
|
|
if (
|
|
|
|
this.noteableType.toLowerCase() === constants.ISSUE_NOTEABLE_TYPE &&
|
|
|
|
this.isOpen &&
|
|
|
|
this.getBlockedByIssues &&
|
|
|
|
this.getBlockedByIssues.length > 0
|
|
|
|
) {
|
|
|
|
this.toggleBlockedIssueWarning(true);
|
|
|
|
return;
|
|
|
|
}
|
2018-03-16 16:16:21 -04:00
|
|
|
if (this.isOpen) {
|
2020-04-21 11:21:10 -04:00
|
|
|
this.forceCloseIssue();
|
2018-03-16 16:16:21 -04:00
|
|
|
} else {
|
|
|
|
this.reopenIssue()
|
2019-07-09 04:44:19 -04:00
|
|
|
.then(() => {
|
|
|
|
this.enableButton();
|
|
|
|
refreshUserMergeRequestCounts();
|
|
|
|
})
|
2018-10-16 03:54:39 -04:00
|
|
|
.catch(({ data }) => {
|
2018-03-16 16:16:21 -04:00
|
|
|
this.enableButton();
|
|
|
|
this.toggleStateButtonLoading(false);
|
2018-10-16 03:54:39 -04:00
|
|
|
let errorMessage = sprintf(
|
|
|
|
__('Something went wrong while reopening the %{issuable}. Please try again later'),
|
|
|
|
{ issuable: this.noteableDisplayName },
|
2018-03-16 16:16:21 -04:00
|
|
|
);
|
2018-10-16 03:54:39 -04:00
|
|
|
|
|
|
|
if (data) {
|
|
|
|
errorMessage = Object.values(data).join('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
Flash(errorMessage);
|
2018-03-16 16:16:21 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2020-04-21 11:21:10 -04:00
|
|
|
forceCloseIssue() {
|
|
|
|
this.closeIssue()
|
|
|
|
.then(() => {
|
|
|
|
this.enableButton();
|
|
|
|
refreshUserMergeRequestCounts();
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
this.enableButton();
|
|
|
|
this.toggleStateButtonLoading(false);
|
|
|
|
Flash(
|
|
|
|
sprintf(
|
|
|
|
__('Something went wrong while closing the %{issuable}. Please try again later'),
|
|
|
|
{ issuable: this.noteableDisplayName },
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
discard(shouldClear = true) {
|
|
|
|
// `blur` is needed to clear slash commands autocomplete cache if event fired.
|
|
|
|
// `focus` is needed to remain cursor in the textarea.
|
|
|
|
this.$refs.textarea.blur();
|
|
|
|
this.$refs.textarea.focus();
|
2017-07-26 04:01:12 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
if (shouldClear) {
|
|
|
|
this.note = '';
|
|
|
|
this.resizeTextarea();
|
|
|
|
this.$refs.markdownField.previewMarkdown = false;
|
|
|
|
}
|
2017-08-04 05:29:01 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
this.autosave.reset();
|
|
|
|
},
|
|
|
|
setNoteType(type) {
|
|
|
|
this.noteType = type;
|
|
|
|
},
|
|
|
|
editCurrentUserLastNote() {
|
|
|
|
if (this.note === '') {
|
|
|
|
const lastNote = this.getCurrentUserLastNote;
|
2017-07-28 14:59:31 -04:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
if (lastNote) {
|
|
|
|
eventHub.$emit('enterEditMode', {
|
|
|
|
noteId: lastNote.id,
|
|
|
|
});
|
2017-07-10 17:53:52 -04:00
|
|
|
}
|
2018-03-16 16:16:21 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
initAutoSave() {
|
|
|
|
if (this.isLoggedIn) {
|
2018-06-21 08:22:40 -04:00
|
|
|
const noteableType = capitalizeFirstCharacter(convertToCamelCase(this.noteableType));
|
2018-02-27 19:10:43 -05:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
this.autosave = new Autosave($(this.$refs.textarea), [
|
2019-07-04 06:20:38 -04:00
|
|
|
__('Note'),
|
2018-03-16 16:16:21 -04:00
|
|
|
noteableType,
|
|
|
|
this.getNoteableData.id,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resizeTextarea() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
Autosize.update(this.$refs.textarea);
|
|
|
|
});
|
2017-07-10 17:53:52 -04:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
};
|
2017-06-23 11:42:08 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2017-07-04 17:56:25 -04:00
|
|
|
<div>
|
2017-12-04 11:19:07 -05:00
|
|
|
<note-signed-out-widget v-if="!isLoggedIn" />
|
2018-11-16 15:07:38 -05:00
|
|
|
<discussion-locked-widget v-else-if="!canCreateNote" :issuable-type="issuableTypeTitle" />
|
2018-11-29 08:54:40 -05:00
|
|
|
<ul v-else-if="canCreateNote" class="notes notes-form timeline">
|
|
|
|
<timeline-entry-item class="note-form">
|
|
|
|
<div class="flash-container error-alert timeline-content"></div>
|
|
|
|
<div class="timeline-icon d-none d-sm-none d-md-block">
|
|
|
|
<user-avatar-link
|
|
|
|
v-if="author"
|
|
|
|
:link-href="author.path"
|
|
|
|
:img-src="author.avatar_url"
|
|
|
|
:img-alt="author.name"
|
|
|
|
:img-size="40"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="timeline-content timeline-content-form">
|
|
|
|
<form ref="commentForm" class="new-note common-note-form gfm-form js-main-target-form">
|
|
|
|
<div class="error-alert"></div>
|
2017-09-29 13:31:09 -04:00
|
|
|
|
2018-11-29 08:54:40 -05:00
|
|
|
<issue-warning
|
|
|
|
v-if="hasWarning(getNoteableData)"
|
|
|
|
:is-locked="isLocked(getNoteableData)"
|
|
|
|
:is-confidential="isConfidential(getNoteableData)"
|
2019-06-06 06:37:02 -04:00
|
|
|
:locked-issue-docs-path="lockedIssueDocsPath"
|
|
|
|
:confidential-issue-docs-path="confidentialIssueDocsPath"
|
2018-11-29 08:54:40 -05:00
|
|
|
/>
|
2017-09-14 07:01:07 -04:00
|
|
|
|
2018-11-29 08:54:40 -05:00
|
|
|
<markdown-field
|
|
|
|
ref="markdownField"
|
2019-12-18 07:07:48 -05:00
|
|
|
:is-submitting="isSubmitting"
|
2018-11-29 08:54:40 -05:00
|
|
|
:markdown-preview-path="markdownPreviewPath"
|
|
|
|
:markdown-docs-path="markdownDocsPath"
|
|
|
|
:quick-actions-docs-path="quickActionsDocsPath"
|
|
|
|
:add-spacing-classes="false"
|
|
|
|
>
|
|
|
|
<textarea
|
|
|
|
id="note-body"
|
|
|
|
ref="textarea"
|
|
|
|
slot="textarea"
|
|
|
|
v-model="note"
|
2019-04-25 07:40:34 -04:00
|
|
|
dir="auto"
|
2018-11-29 08:54:40 -05:00
|
|
|
:disabled="isSubmitting"
|
|
|
|
name="note[note]"
|
|
|
|
class="note-textarea js-vue-comment-form js-note-text
|
2018-10-05 05:00:55 -04:00
|
|
|
js-gfm-input js-autosize markdown-area js-vue-textarea qa-comment-input"
|
2018-11-29 08:54:40 -05:00
|
|
|
data-supports-quick-actions="true"
|
2019-07-04 06:20:38 -04:00
|
|
|
:aria-label="__('Description')"
|
|
|
|
:placeholder="__('Write a comment or drag your files here…')"
|
2019-01-10 16:56:37 -05:00
|
|
|
@keydown.up="editCurrentUserLastNote()"
|
|
|
|
@keydown.meta.enter="handleSave()"
|
|
|
|
@keydown.ctrl.enter="handleSave()"
|
2018-11-29 08:54:40 -05:00
|
|
|
>
|
|
|
|
</textarea>
|
|
|
|
</markdown-field>
|
2020-04-21 11:21:10 -04:00
|
|
|
<gl-alert
|
|
|
|
v-if="isToggleBlockedIssueWarning"
|
|
|
|
class="prepend-top-16"
|
|
|
|
:title="__('Are you sure you want to close this blocked issue?')"
|
|
|
|
:primary-button-text="__('Yes, close issue')"
|
|
|
|
:secondary-button-text="__('Cancel')"
|
|
|
|
variant="warning"
|
|
|
|
:dismissible="false"
|
|
|
|
@primaryAction="forceCloseIssue"
|
|
|
|
@secondaryAction="toggleBlockedIssueWarning(false) && enableButton()"
|
|
|
|
>
|
|
|
|
<p>
|
|
|
|
<gl-sprintf
|
|
|
|
:message="
|
|
|
|
__('This issue is currently blocked by the following issues: %{issues}.')
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template #issues>
|
|
|
|
<gl-intersperse>
|
|
|
|
<gl-link
|
|
|
|
v-for="blockingIssue in getBlockedByIssues"
|
|
|
|
:key="blockingIssue.web_url"
|
|
|
|
:href="blockingIssue.web_url"
|
|
|
|
>#{{ blockingIssue.iid }}</gl-link
|
|
|
|
>
|
|
|
|
</gl-intersperse>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
|
|
|
</p>
|
|
|
|
</gl-alert>
|
2018-11-29 08:54:40 -05:00
|
|
|
<div class="note-form-actions">
|
|
|
|
<div
|
|
|
|
class="float-left btn-group
|
2018-11-16 15:07:38 -05:00
|
|
|
append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown"
|
2018-11-29 08:54:40 -05:00
|
|
|
>
|
|
|
|
<button
|
|
|
|
:disabled="isSubmitButtonDisabled"
|
2019-01-10 12:57:11 -05:00
|
|
|
class="btn btn-success js-comment-button js-comment-submit-button
|
2018-10-05 05:00:55 -04:00
|
|
|
qa-comment-button"
|
2018-11-29 08:54:40 -05:00
|
|
|
type="submit"
|
2019-04-12 11:32:24 -04:00
|
|
|
:data-track-label="trackingLabel"
|
|
|
|
data-track-event="click_button"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click.prevent="handleSave()"
|
2018-11-29 08:54:40 -05:00
|
|
|
>
|
2019-07-04 06:20:38 -04:00
|
|
|
{{ commentButtonTitle }}
|
2018-11-29 08:54:40 -05:00
|
|
|
</button>
|
2017-07-12 17:50:25 -04:00
|
|
|
<button
|
2018-11-29 08:54:40 -05:00
|
|
|
:disabled="isSubmitButtonDisabled"
|
|
|
|
name="button"
|
2018-06-11 05:49:47 -04:00
|
|
|
type="button"
|
2019-01-10 12:57:11 -05:00
|
|
|
class="btn btn-success note-type-toggle js-note-new-discussion dropdown-toggle qa-note-dropdown"
|
2018-11-29 08:54:40 -05:00
|
|
|
data-display="static"
|
|
|
|
data-toggle="dropdown"
|
2019-07-04 06:20:38 -04:00
|
|
|
:aria-label="__('Open comment type dropdown')"
|
2018-11-16 15:07:38 -05:00
|
|
|
>
|
2018-11-29 08:54:40 -05:00
|
|
|
<i aria-hidden="true" class="fa fa-caret-down toggle-icon"> </i>
|
2017-07-12 17:50:25 -04:00
|
|
|
</button>
|
2018-11-29 08:54:40 -05:00
|
|
|
|
|
|
|
<ul class="note-type-dropdown dropdown-open-top dropdown-menu">
|
|
|
|
<li :class="{ 'droplab-item-selected': noteType === 'comment' }">
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="btn btn-transparent"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click.prevent="setNoteType('comment')"
|
2018-11-29 08:54:40 -05:00
|
|
|
>
|
|
|
|
<i aria-hidden="true" class="fa fa-check icon"> </i>
|
|
|
|
<div class="description">
|
2019-07-04 06:20:38 -04:00
|
|
|
<strong>{{ __('Comment') }}</strong>
|
|
|
|
<p>
|
|
|
|
{{
|
|
|
|
sprintf(__('Add a general comment to this %{noteableDisplayName}.'), {
|
|
|
|
noteableDisplayName,
|
|
|
|
})
|
|
|
|
}}
|
|
|
|
</p>
|
2018-11-29 08:54:40 -05:00
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li class="divider droplab-item-ignore"></li>
|
|
|
|
<li :class="{ 'droplab-item-selected': noteType === 'discussion' }">
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="btn btn-transparent qa-discussion-option"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click.prevent="setNoteType('discussion')"
|
2018-11-29 08:54:40 -05:00
|
|
|
>
|
|
|
|
<i aria-hidden="true" class="fa fa-check icon"> </i>
|
|
|
|
<div class="description">
|
2019-07-04 06:20:38 -04:00
|
|
|
<strong>{{ __('Start thread') }}</strong>
|
2018-11-29 08:54:40 -05:00
|
|
|
<p>{{ startDiscussionDescription }}</p>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2017-07-12 17:50:25 -04:00
|
|
|
</div>
|
2018-11-29 08:54:40 -05:00
|
|
|
|
|
|
|
<loading-button
|
2020-04-21 11:21:10 -04:00
|
|
|
v-if="canToggleIssueState && !isToggleBlockedIssueWarning"
|
2018-11-29 08:54:40 -05:00
|
|
|
:loading="isToggleStateButtonLoading"
|
|
|
|
:container-class="[
|
|
|
|
actionButtonClassNames,
|
|
|
|
'btn btn-comment btn-comment-and-close js-action-button',
|
|
|
|
]"
|
|
|
|
:disabled="isToggleStateButtonLoading || isSubmitting"
|
|
|
|
:label="issueActionButtonTitle"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click="handleSave(true)"
|
2018-11-29 08:54:40 -05:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</form>
|
2017-06-23 11:42:08 -04:00
|
|
|
</div>
|
2018-11-29 08:54:40 -05:00
|
|
|
</timeline-entry-item>
|
|
|
|
</ul>
|
2017-07-04 17:56:25 -04:00
|
|
|
</div>
|
2017-06-23 11:42:08 -04:00
|
|
|
</template>
|