summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/notes/components/note_actions.vue20
-rw-r--r--app/assets/javascripts/notes/components/note_actions/reply_button.vue40
-rw-r--r--app/assets/javascripts/notes/components/noteable_discussion.vue1
-rw-r--r--app/assets/javascripts/notes/components/noteable_note.vue22
-rw-r--r--app/assets/javascripts/notes/components/notes_app.vue7
-rw-r--r--app/assets/javascripts/notes/stores/actions.js3
-rw-r--r--app/assets/javascripts/notes/stores/mutation_types.js1
-rw-r--r--app/assets/javascripts/notes/stores/mutations.js5
-rw-r--r--app/controllers/concerns/issuable_actions.rb3
-rw-r--r--app/models/concerns/noteable.rb15
-rw-r--r--app/models/discussion.rb6
-rw-r--r--app/models/individual_note_discussion.rb8
-rw-r--r--app/models/sent_notification.rb25
-rw-r--r--app/services/notes/build_service.rb2
-rw-r--r--app/services/notes/create_service.rb4
15 files changed, 24 insertions, 138 deletions
diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue
index 394f2a80a67..d99694b06e9 100644
--- a/app/assets/javascripts/notes/components/note_actions.vue
+++ b/app/assets/javascripts/notes/components/note_actions.vue
@@ -2,13 +2,11 @@
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: {
@@ -23,11 +21,6 @@ export default {
type: [String, Number],
required: true,
},
- discussionId: {
- type: String,
- required: false,
- default: '',
- },
noteUrl: {
type: String,
required: false,
@@ -43,10 +36,6 @@ export default {
required: false,
default: null,
},
- showReply: {
- type: Boolean,
- required: true,
- },
canEdit: {
type: Boolean,
required: true,
@@ -91,9 +80,6 @@ export default {
},
computed: {
...mapGetters(['getUserDataByProp']),
- showReplyButton() {
- return gon.features && gon.features.replyToIndividualNotes && this.showReply;
- },
shouldShowActionsDropdown() {
return this.currentUserId && (this.canEdit || this.canReportAsAbuse);
},
@@ -167,12 +153,6 @@ export default {
<icon css-classes="link-highlight award-control-icon-super-positive" name="emoji_smiley" />
</a>
</div>
- <reply-button
- v-if="showReplyButton"
- ref="replyButton"
- class="js-reply-button"
- :note-id="discussionId"
- />
<div v-if="canEdit" class="note-actions-item">
<button
v-gl-tooltip.bottom
diff --git a/app/assets/javascripts/notes/components/note_actions/reply_button.vue b/app/assets/javascripts/notes/components/note_actions/reply_button.vue
deleted file mode 100644
index b2f9d7f128a..00000000000
--- a/app/assets/javascripts/notes/components/note_actions/reply_button.vue
+++ /dev/null
@@ -1,40 +0,0 @@
-<script>
-import { mapActions } from 'vuex';
-import { GlTooltipDirective, GlButton } from '@gitlab/ui';
-import Icon from '~/vue_shared/components/icon.vue';
-
-export default {
- name: 'ReplyButton',
- components: {
- Icon,
- GlButton,
- },
- directives: {
- GlTooltip: GlTooltipDirective,
- },
- props: {
- noteId: {
- type: String,
- required: true,
- },
- },
- methods: {
- ...mapActions(['convertToDiscussion']),
- },
-};
-</script>
-
-<template>
- <div class="note-actions-item">
- <gl-button
- ref="button"
- v-gl-tooltip.bottom
- class="note-action-button"
- variant="transparent"
- :title="__('Reply to comment')"
- @click="convertToDiscussion(noteId)"
- >
- <icon name="comment" css-classes="link-highlight" />
- </gl-button>
- </div>
-</template>
diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue
index b7e9f7c2028..e26cce1c47f 100644
--- a/app/assets/javascripts/notes/components/noteable_discussion.vue
+++ b/app/assets/javascripts/notes/components/noteable_discussion.vue
@@ -398,7 +398,6 @@ Please check your network connection and try again.`;
:line="line"
:commit="commit"
:help-page-path="helpPagePath"
- :show-reply-button="canReply"
@handleDeleteNote="deleteNoteHandler"
>
<note-edited-text
diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue
index 56108a58010..3c48d81ed05 100644
--- a/app/assets/javascripts/notes/components/noteable_note.vue
+++ b/app/assets/javascripts/notes/components/noteable_note.vue
@@ -29,11 +29,6 @@ export default {
type: Object,
required: true,
},
- discussion: {
- type: Object,
- required: false,
- default: null,
- },
line: {
type: Object,
required: false,
@@ -59,7 +54,7 @@ export default {
};
},
computed: {
- ...mapGetters(['targetNoteHash', 'getNoteableData', 'getUserData', 'commentsDisabled']),
+ ...mapGetters(['targetNoteHash', 'getNoteableData', 'getUserData']),
author() {
return this.note.author;
},
@@ -85,19 +80,6 @@ export default {
isTarget() {
return this.targetNoteHash === this.noteAnchorId;
},
- discussionId() {
- if (this.discussion) {
- return this.discussion.id;
- }
- return '';
- },
- showReplyButton() {
- if (!this.discussion || !this.getNoteableData.current_user.can_create_note) {
- return false;
- }
-
- return this.discussion.individual_note && !this.commentsDisabled;
- },
actionText() {
if (!this.commit) {
return '';
@@ -249,7 +231,6 @@ export default {
:note-id="note.id"
:note-url="note.noteable_note_url"
:access-level="note.human_access"
- :show-reply="showReplyButton"
:can-edit="note.current_user.can_edit"
:can-award-emoji="note.current_user.can_award_emoji"
:can-delete="note.current_user.can_edit"
@@ -260,7 +241,6 @@ export default {
:is-resolved="note.resolved"
:is-resolving="isResolving"
:resolved-by="note.resolved_by"
- :discussion-id="discussionId"
@handleEdit="editHandler"
@handleDelete="deleteHandler"
@handleResolve="resolveHandler"
diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue
index 6d72b72e628..5edceea043c 100644
--- a/app/assets/javascripts/notes/components/notes_app.vue
+++ b/app/assets/javascripts/notes/components/notes_app.vue
@@ -199,12 +199,7 @@ export default {
:key="discussion.id"
:note="discussion.notes[0]"
/>
- <noteable-note
- v-else
- :key="discussion.id"
- :note="discussion.notes[0]"
- :discussion="discussion"
- />
+ <noteable-note v-else :key="discussion.id" :note="discussion.notes[0]" />
</template>
<noteable-discussion
v-else
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js
index ff65f14d529..2105a62cecb 100644
--- a/app/assets/javascripts/notes/stores/actions.js
+++ b/app/assets/javascripts/notes/stores/actions.js
@@ -426,8 +426,5 @@ export const submitSuggestion = (
});
};
-export const convertToDiscussion = ({ commit }, noteId) =>
- commit(types.CONVERT_TO_DISCUSSION, noteId);
-
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
diff --git a/app/assets/javascripts/notes/stores/mutation_types.js b/app/assets/javascripts/notes/stores/mutation_types.js
index 2bffedad336..df943c155f4 100644
--- a/app/assets/javascripts/notes/stores/mutation_types.js
+++ b/app/assets/javascripts/notes/stores/mutation_types.js
@@ -17,7 +17,6 @@ export const SET_NOTES_FETCHED_STATE = 'SET_NOTES_FETCHED_STATE';
export const SET_NOTES_LOADING_STATE = 'SET_NOTES_LOADING_STATE';
export const DISABLE_COMMENTS = 'DISABLE_COMMENTS';
export const APPLY_SUGGESTION = 'APPLY_SUGGESTION';
-export const CONVERT_TO_DISCUSSION = 'CONVERT_TO_DISCUSSION';
// DISCUSSION
export const COLLAPSE_DISCUSSION = 'COLLAPSE_DISCUSSION';
diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js
index d167f8ef421..33d39ad2ec9 100644
--- a/app/assets/javascripts/notes/stores/mutations.js
+++ b/app/assets/javascripts/notes/stores/mutations.js
@@ -264,9 +264,4 @@ export default {
).length;
state.hasUnresolvedDiscussions = state.unresolvedDiscussionsCount > 1;
},
-
- [types.CONVERT_TO_DISCUSSION](state, discussionId) {
- const discussion = utils.findNoteObjectById(state.discussions, discussionId);
- Object.assign(discussion, { individual_note: false });
- },
};
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index cd3fa641e89..8ef3b6502df 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -7,9 +7,6 @@ module IssuableActions
included do
before_action :authorize_destroy_issuable!, only: :destroy
before_action :authorize_admin_issuable!, only: :bulk_update
- before_action only: :show do
- push_frontend_feature_flag(:reply_to_individual_notes)
- end
end
def permitted_keys
diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb
index 3c74034b527..29476654bf7 100644
--- a/app/models/concerns/noteable.rb
+++ b/app/models/concerns/noteable.rb
@@ -1,18 +1,9 @@
# frozen_string_literal: true
module Noteable
- extend ActiveSupport::Concern
-
- # `Noteable` class names that support resolvable notes.
+ # Names of all implementers of `Noteable` that support resolvable notes.
RESOLVABLE_TYPES = %w(MergeRequest).freeze
- class_methods do
- # `Noteable` class names that support replying to individual notes.
- def replyable_types
- %w(Issue MergeRequest)
- end
- end
-
def base_class_name
self.class.base_class.name
end
@@ -35,10 +26,6 @@ module Noteable
DiscussionNote.noteable_types.include?(base_class_name)
end
- def supports_replying_to_individual_notes?
- supports_discussions? && self.class.replyable_types.include?(base_class_name)
- end
-
def supports_suggestion?
false
end
diff --git a/app/models/discussion.rb b/app/models/discussion.rb
index f2678e0597d..dbc7b6e67be 100644
--- a/app/models/discussion.rb
+++ b/app/models/discussion.rb
@@ -17,8 +17,6 @@ class Discussion
:for_commit?,
:for_merge_request?,
- :save,
-
to: :first_note
def project_id
@@ -118,10 +116,6 @@ class Discussion
false
end
- def can_convert_to_discussion?
- false
- end
-
def new_discussion?
notes.length == 1
end
diff --git a/app/models/individual_note_discussion.rb b/app/models/individual_note_discussion.rb
index aab0ff93468..07ee7470ea2 100644
--- a/app/models/individual_note_discussion.rb
+++ b/app/models/individual_note_discussion.rb
@@ -13,14 +13,6 @@ class IndividualNoteDiscussion < Discussion
true
end
- def can_convert_to_discussion?
- noteable.supports_replying_to_individual_notes? && Feature.enabled?(:reply_to_individual_notes)
- end
-
- def convert_to_discussion!
- first_note.becomes!(Discussion.note_class).to_discussion
- end
-
def reply_attributes
super.tap { |attrs| attrs.delete(:discussion_id) }
end
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 6caab24143b..e65b3df0fb6 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -48,7 +48,7 @@ class SentNotification < ActiveRecord::Base
end
def record_note(note, recipient_id, reply_key = self.reply_key, attrs = {})
- attrs[:in_reply_to_discussion_id] = note.discussion_id if note.part_of_discussion?
+ attrs[:in_reply_to_discussion_id] = note.discussion_id
record(note.noteable, recipient_id, reply_key, attrs)
end
@@ -99,12 +99,29 @@ class SentNotification < ActiveRecord::Base
private
def reply_params
- {
+ attrs = {
noteable_type: self.noteable_type,
noteable_id: self.noteable_id,
- commit_id: self.commit_id,
- in_reply_to_discussion_id: self.in_reply_to_discussion_id
+ commit_id: self.commit_id
}
+
+ if self.in_reply_to_discussion_id.present?
+ attrs[:in_reply_to_discussion_id] = self.in_reply_to_discussion_id
+ else
+ # Remove in GitLab 10.0, when we will not support replying to SentNotifications
+ # that don't have `in_reply_to_discussion_id` anymore.
+ attrs.merge!(
+ type: self.note_type,
+
+ # LegacyDiffNote
+ line_code: self.line_code,
+
+ # DiffNote
+ position: self.position.to_json
+ )
+ end
+
+ attrs
end
def note_valid
diff --git a/app/services/notes/build_service.rb b/app/services/notes/build_service.rb
index 541f3e0d23c..bae98ede561 100644
--- a/app/services/notes/build_service.rb
+++ b/app/services/notes/build_service.rb
@@ -15,8 +15,6 @@ module Notes
return note
end
- discussion = discussion.convert_to_discussion! if discussion.can_convert_to_discussion?
-
params.merge!(discussion.reply_attributes)
should_resolve = discussion.resolved?
end
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb
index b975c3a8cb6..c4546f30235 100644
--- a/app/services/notes/create_service.rb
+++ b/app/services/notes/create_service.rb
@@ -34,10 +34,6 @@ module Notes
end
if !only_commands && note.save
- if note.part_of_discussion? && note.discussion.can_convert_to_discussion?
- note.discussion.convert_to_discussion!.save(touch: false)
- end
-
todo_service.new_note(note, current_user)
clear_noteable_diffs_cache(note)
Suggestions::CreateService.new(note).execute