From a04d9ba90c0d1df02f613b7aa01ef598e1ac5b28 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Wed, 6 Feb 2019 10:31:46 +0000 Subject: Add reply to notes to turn into discussions --- .../javascripts/notes/components/note_actions.vue | 20 +++ .../notes/components/note_actions/reply_button.vue | 40 ++++++ .../notes/components/noteable_discussion.vue | 1 + .../javascripts/notes/components/noteable_note.vue | 22 ++- .../javascripts/notes/components/notes_app.vue | 7 +- app/assets/javascripts/notes/stores/actions.js | 3 + .../javascripts/notes/stores/mutation_types.js | 1 + app/assets/javascripts/notes/stores/mutations.js | 5 + app/controllers/concerns/issuable_actions.rb | 3 + app/models/concerns/noteable.rb | 15 ++- app/models/discussion.rb | 6 + app/models/individual_note_discussion.rb | 8 ++ app/models/sent_notification.rb | 25 +--- app/services/notes/build_service.rb | 2 + app/services/notes/create_service.rb | 4 + locale/gitlab.pot | 3 + .../merge_request/user_posts_notes_spec.rb | 32 +++++ .../components/note_actions/reply_button_spec.js | 46 +++++++ .../notes/components/note_actions_spec.js | 149 +++++++++++++++------ spec/javascripts/notes/stores/actions_spec.js | 14 ++ spec/javascripts/notes/stores/mutation_spec.js | 23 ++++ .../email/handler/create_note_handler_spec.rb | 26 +++- spec/models/sent_notification_spec.rb | 34 ++++- spec/services/notes/build_service_spec.rb | 40 ++++++ spec/services/notes/create_service_spec.rb | 37 +++++ 25 files changed, 493 insertions(+), 73 deletions(-) create mode 100644 app/assets/javascripts/notes/components/note_actions/reply_button.vue create mode 100644 spec/javascripts/notes/components/note_actions/reply_button_spec.js diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue index d99694b06e9..394f2a80a67 100644 --- a/app/assets/javascripts/notes/components/note_actions.vue +++ b/app/assets/javascripts/notes/components/note_actions.vue @@ -2,11 +2,13 @@ import { mapGetters } from 'vuex'; import Icon from '~/vue_shared/components/icon.vue'; import { GlLoadingIcon, GlTooltipDirective } from '@gitlab/ui'; +import ReplyButton from './note_actions/reply_button.vue'; export default { name: 'NoteActions', components: { Icon, + ReplyButton, GlLoadingIcon, }, directives: { @@ -21,6 +23,11 @@ export default { type: [String, Number], required: true, }, + discussionId: { + type: String, + required: false, + default: '', + }, noteUrl: { type: String, required: false, @@ -36,6 +43,10 @@ export default { required: false, default: null, }, + showReply: { + type: Boolean, + required: true, + }, canEdit: { type: Boolean, required: true, @@ -80,6 +91,9 @@ export default { }, computed: { ...mapGetters(['getUserDataByProp']), + showReplyButton() { + return gon.features && gon.features.replyToIndividualNotes && this.showReply; + }, shouldShowActionsDropdown() { return this.currentUserId && (this.canEdit || this.canReportAsAbuse); }, @@ -153,6 +167,12 @@ export default { +