|
7 | 7 | import TaskList from '../../task_list';
|
8 | 8 | import * as constants from '../constants';
|
9 | 9 | import eventHub from '../event_hub';
|
10 |
| - import confidentialIssue from '../../vue_shared/components/issue/confidential_issue_warning.vue'; |
| 10 | + import issueWarning from '../../vue_shared/components/issue/issue_warning.vue'; |
11 | 11 | import issueNoteSignedOutWidget from './issue_note_signed_out_widget.vue';
|
| 12 | + import issueDiscussionLockedWidget from './issue_discussion_locked_widget.vue'; |
12 | 13 | import markdownField from '../../vue_shared/components/markdown/field.vue';
|
13 | 14 | import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
|
| 15 | + import issuableStateMixin from '../mixins/issuable_state'; |
14 | 16 |
|
15 | 17 | export default {
|
16 | 18 | name: 'issueCommentForm',
|
|
26 | 28 | };
|
27 | 29 | },
|
28 | 30 | components: {
|
29 |
| - confidentialIssue, |
| 31 | + issueWarning, |
30 | 32 | issueNoteSignedOutWidget,
|
| 33 | + issueDiscussionLockedWidget, |
31 | 34 | markdownField,
|
32 | 35 | userAvatarLink,
|
33 | 36 | },
|
|
55 | 58 | isIssueOpen() {
|
56 | 59 | return this.issueState === constants.OPENED || this.issueState === constants.REOPENED;
|
57 | 60 | },
|
| 61 | + canCreateNote() { |
| 62 | + return this.getIssueData.current_user.can_create_note; |
| 63 | + }, |
58 | 64 | issueActionButtonTitle() {
|
59 | 65 | if (this.note.length) {
|
60 | 66 | const actionText = this.isIssueOpen ? 'close' : 'reopen';
|
|
90 | 96 | endpoint() {
|
91 | 97 | return this.getIssueData.create_note_path;
|
92 | 98 | },
|
93 |
| - isConfidentialIssue() { |
94 |
| - return this.getIssueData.confidential; |
95 |
| - }, |
96 | 99 | },
|
97 | 100 | methods: {
|
98 | 101 | ...mapActions([
|
|
220 | 223 | });
|
221 | 224 | },
|
222 | 225 | },
|
| 226 | + mixins: [ |
| 227 | + issuableStateMixin, |
| 228 | + ], |
223 | 229 | mounted() {
|
224 | 230 | // jQuery is needed here because it is a custom event being dispatched with jQuery.
|
225 | 231 | $(document).on('issuable:change', (e, isClosed) => {
|
|
235 | 241 | <template>
|
236 | 242 | <div>
|
237 | 243 | <issue-note-signed-out-widget v-if="!isLoggedIn" />
|
| 244 | + <issue-discussion-locked-widget v-else-if="!canCreateNote" /> |
238 | 245 | <ul
|
239 | 246 | v-else
|
240 | 247 | class="notes notes-form timeline">
|
|
253 | 260 | <div class="timeline-content timeline-content-form">
|
254 | 261 | <form
|
255 | 262 | ref="commentForm"
|
256 |
| - class="new-note js-quick-submit common-note-form gfm-form js-main-target-form"> |
257 |
| - <confidentialIssue v-if="isConfidentialIssue" /> |
| 263 | + class="new-note js-quick-submit common-note-form gfm-form js-main-target-form" |
| 264 | + > |
| 265 | + |
258 | 266 | <div class="error-alert"></div>
|
| 267 | + |
| 268 | + <issue-warning |
| 269 | + v-if="hasWarning(getIssueData)" |
| 270 | + :is-locked="isLocked(getIssueData)" |
| 271 | + :is-confidential="isConfidential(getIssueData)" |
| 272 | + /> |
| 273 | + |
259 | 274 | <markdown-field
|
260 | 275 | :markdown-preview-path="markdownPreviewPath"
|
261 | 276 | :markdown-docs-path="markdownDocsPath"
|
262 | 277 | :quick-actions-docs-path="quickActionsDocsPath"
|
263 | 278 | :add-spacing-classes="false"
|
264 |
| - :is-confidential-issue="isConfidentialIssue" |
265 | 279 | ref="markdownField">
|
266 | 280 | <textarea
|
267 | 281 | id="note-body"
|
|
0 commit comments