diff options
Diffstat (limited to 'app/assets/javascripts/notes')
8 files changed, 28 insertions, 12 deletions
diff --git a/app/assets/javascripts/notes/components/comment_field_layout.vue b/app/assets/javascripts/notes/components/comment_field_layout.vue index 47d14783d5d..9638c20e28c 100644 --- a/app/assets/javascripts/notes/components/comment_field_layout.vue +++ b/app/assets/javascripts/notes/components/comment_field_layout.vue @@ -14,6 +14,11 @@ export default { type: Object, required: true, }, + noteIsConfidential: { + type: Boolean, + required: false, + default: false, + }, noteableType: { type: String, required: false, @@ -38,6 +43,9 @@ export default { emailParticipants() { return this.noteableData.issue_email_participants?.map(({ email }) => email) || []; }, + showEmailParticipantsWarning() { + return this.emailParticipants.length && !this.noteIsConfidential; + }, }, }; </script> @@ -61,7 +69,7 @@ export default { /> <slot></slot> <email-participants-warning - v-if="emailParticipants.length" + v-if="showEmailParticipantsWarning" class="gl-border-t-1 gl-border-t-solid gl-border-t-gray-100 gl-rounded-base gl-rounded-top-left-none! gl-rounded-top-right-none!" :emails="emailParticipants" /> diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index 9504ed78778..2ebebd76e1e 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -380,6 +380,7 @@ export default { <comment-field-layout :with-alert-container="true" :noteable-data="getNoteableData" + :note-is-confidential="noteIsConfidential" :noteable-type="noteableType" > <markdown-field diff --git a/app/assets/javascripts/notes/components/discussion_resolve_button.vue b/app/assets/javascripts/notes/components/discussion_resolve_button.vue index e060a6affd4..b1aee19d5b2 100644 --- a/app/assets/javascripts/notes/components/discussion_resolve_button.vue +++ b/app/assets/javascripts/notes/components/discussion_resolve_button.vue @@ -21,7 +21,7 @@ export default { </script> <template> - <gl-button :loading="isResolving" class="ml-sm-2" @click="$emit('onClick')"> + <gl-button :loading="isResolving" class="gl-xs-w-full ml-sm-2" @click="$emit('onClick')"> {{ buttonTitle }} </gl-button> </template> diff --git a/app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue b/app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue index 5f429cbf462..9119d319d72 100644 --- a/app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue +++ b/app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue @@ -29,7 +29,7 @@ export default { :href="url" :title="$options.i18n.buttonLabel" :aria-label="$options.i18n.buttonLabel" - class="new-issue-for-discussion discussion-create-issue-btn" + class="new-issue-for-discussion discussion-create-issue-btn gl-xs-w-full" icon="issue-new" /> </div> diff --git a/app/assets/javascripts/notes/components/note_body.vue b/app/assets/javascripts/notes/components/note_body.vue index 8c5d81c0cc9..9864e91c009 100644 --- a/app/assets/javascripts/notes/components/note_body.vue +++ b/app/assets/javascripts/notes/components/note_body.vue @@ -115,11 +115,11 @@ export default { renderGFM() { $(this.$refs['note-body']).renderGFM(); }, - handleFormUpdate(note, parentElement, callback, resolveDiscussion) { - this.$emit('handleFormUpdate', note, parentElement, callback, resolveDiscussion); + handleFormUpdate(noteText, parentElement, callback, resolveDiscussion) { + this.$emit('handleFormUpdate', { noteText, parentElement, callback, resolveDiscussion }); }, formCancelHandler(shouldConfirm, isDirty) { - this.$emit('cancelForm', shouldConfirm, isDirty); + this.$emit('cancelForm', { shouldConfirm, isDirty }); }, applySuggestion({ suggestionId, flashContainer, callback = () => {}, message }) { const { discussion_id: discussionId, id: noteId } = this.note; diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index 4ce81219f11..f2336e1b6f5 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -326,7 +326,10 @@ export default { ></div> <div class="flash-container timeline-content"></div> <form :data-line-code="lineCode" class="edit-note common-note-form js-quick-submit gfm-form"> - <comment-field-layout :noteable-data="getNoteableData"> + <comment-field-layout + :noteable-data="getNoteableData" + :note-is-confidential="discussion.confidential" + > <markdown-field :markdown-preview-path="markdownPreviewPath" :markdown-docs-path="markdownDocsPath" diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index 5ea431224ce..3c6ed0a8aac 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -263,7 +263,7 @@ export default { this.$refs.noteBody.resetAutoSave(); this.$emit('updateSuccess'); }, - formUpdateHandler(noteText, parentElement, callback, resolveDiscussion) { + formUpdateHandler({ noteText, callback, resolveDiscussion }) { const position = { ...this.note.position, }; @@ -329,7 +329,7 @@ export default { } }); }, - formCancelHandler(shouldConfirm, isDirty) { + formCancelHandler({ shouldConfirm, isDirty }) { if (shouldConfirm && isDirty) { // eslint-disable-next-line no-alert if (!window.confirm(__('Are you sure you want to cancel editing this comment?'))) return; @@ -392,6 +392,7 @@ export default { :img-src="author.avatar_url" :img-alt="author.name" :img-size="40" + lazy > <template #avatar-badge> <slot name="avatar-badge"></slot> diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js index e4241669fbc..2ce60976adb 100644 --- a/app/assets/javascripts/notes/index.js +++ b/app/assets/javascripts/notes/index.js @@ -5,9 +5,12 @@ import initSortDiscussions from './sort_discussions'; import { store } from './stores'; import initTimelineToggle from './timeline'; -const el = document.getElementById('js-vue-notes'); +export default () => { + const el = document.getElementById('js-vue-notes'); + if (!el) { + return; + } -if (el) { // eslint-disable-next-line no-new new Vue({ el, @@ -59,4 +62,4 @@ if (el) { initDiscussionFilters(store); initSortDiscussions(store); initTimelineToggle(store); -} +}; |