summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r--app/assets/javascripts/notes/components/attachments_warning.vue18
-rw-r--r--app/assets/javascripts/notes/components/comment_field_layout.vue17
-rw-r--r--app/assets/javascripts/notes/components/comment_form.vue5
-rw-r--r--app/assets/javascripts/notes/i18n.js3
4 files changed, 43 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes/components/attachments_warning.vue b/app/assets/javascripts/notes/components/attachments_warning.vue
new file mode 100644
index 00000000000..aaa4b0d92b9
--- /dev/null
+++ b/app/assets/javascripts/notes/components/attachments_warning.vue
@@ -0,0 +1,18 @@
+<script>
+import { COMMENT_FORM } from '../i18n';
+
+export default {
+ i18n: COMMENT_FORM.attachmentMsg,
+ data() {
+ return {
+ message: this.$options.i18n,
+ };
+ },
+};
+</script>
+
+<template>
+ <div class="issuable-note-warning" data-testid="attachment-warning">
+ {{ message }}
+ </div>
+</template>
diff --git a/app/assets/javascripts/notes/components/comment_field_layout.vue b/app/assets/javascripts/notes/components/comment_field_layout.vue
index 84bda1b0b5c..cc372520c70 100644
--- a/app/assets/javascripts/notes/components/comment_field_layout.vue
+++ b/app/assets/javascripts/notes/components/comment_field_layout.vue
@@ -1,14 +1,18 @@
<script>
+import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import NoteableWarning from '~/vue_shared/components/notes/noteable_warning.vue';
import EmailParticipantsWarning from './email_participants_warning.vue';
+import AttachmentsWarning from './attachments_warning.vue';
const DEFAULT_NOTEABLE_TYPE = 'Issue';
export default {
components: {
+ AttachmentsWarning,
EmailParticipantsWarning,
NoteableWarning,
},
+ mixins: [glFeatureFlagsMixin()],
props: {
noteableData: {
type: Object,
@@ -29,6 +33,11 @@ export default {
required: false,
default: false,
},
+ containsLink: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
},
computed: {
isLocked() {
@@ -46,6 +55,13 @@ export default {
showEmailParticipantsWarning() {
return this.emailParticipants.length && !this.isInternalNote;
},
+ showAttachmentWarning() {
+ return (
+ this.glFeatures.serviceDeskNewNoteEmailNativeAttachments &&
+ this.showEmailParticipantsWarning &&
+ this.containsLink
+ );
+ },
},
};
</script>
@@ -68,6 +84,7 @@ export default {
:confidential-noteable-docs-path="noteableData.confidential_issues_docs_path"
/>
<slot></slot>
+ <attachments-warning v-if="showAttachmentWarning" />
<email-participants-warning
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!"
diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue
index c6e7117cf2e..4f7256d0b0e 100644
--- a/app/assets/javascripts/notes/components/comment_form.vue
+++ b/app/assets/javascripts/notes/components/comment_form.vue
@@ -28,6 +28,7 @@ import CommentTypeDropdown from './comment_type_dropdown.vue';
import DiscussionLockedWidget from './discussion_locked_widget.vue';
import NoteSignedOutWidget from './note_signed_out_widget.vue';
+const ATTACHMENT_REGEXP = /!?\[.*?\]\(\/uploads\/[0-9a-f]{32}\/.*?\)/;
export default {
name: 'CommentForm',
i18n: COMMENT_FORM,
@@ -176,6 +177,9 @@ export default {
disableSubmitButton() {
return this.note.length === 0 || this.isSubmitting;
},
+ containsLink() {
+ return ATTACHMENT_REGEXP.test(this.note);
+ },
},
mounted() {
// jQuery is needed here because it is a custom event being dispatched with jQuery.
@@ -356,6 +360,7 @@ export default {
:noteable-data="getNoteableData"
:is-internal-note="noteIsInternal"
:noteable-type="noteableType"
+ :contains-link="containsLink"
>
<markdown-field
ref="markdownField"
diff --git a/app/assets/javascripts/notes/i18n.js b/app/assets/javascripts/notes/i18n.js
index 9b5fd69f816..a758a55014a 100644
--- a/app/assets/javascripts/notes/i18n.js
+++ b/app/assets/javascripts/notes/i18n.js
@@ -45,4 +45,7 @@ export const COMMENT_FORM = {
commentHelp: __('Add a general comment to this %{noteableDisplayName}.'),
internalCommentHelp: __('Add a confidential internal note to this %{noteableDisplayName}.'),
},
+ attachmentMsg: s__(
+ 'Notes|Attachments are sent by email. Attachments over 10 MB are sent as links to your GitLab instance, and only accessible to project members.',
+ ),
};