Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-10 18:09:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-10 18:09:14 +0300
commitff06f859cdabec3c874c004f93fe5082aeacf917 (patch)
tree5269b37a4cd5181869267e3ce9ece4d11518752b /app/assets/javascripts/notes
parenta08f8baa63c0aea7fcf969da40d30e6cf56365cc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r--app/assets/javascripts/notes/stores/actions.js2
-rw-r--r--app/assets/javascripts/notes/stores/mutations.js38
2 files changed, 23 insertions, 17 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js
index 37986c8a02d..2c60b5ee84a 100644
--- a/app/assets/javascripts/notes/stores/actions.js
+++ b/app/assets/javascripts/notes/stores/actions.js
@@ -167,7 +167,7 @@ export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes)
if (discussion) {
commit(types.ADD_NEW_REPLY_TO_DISCUSSION, note);
- } else if (note.type === constants.DIFF_NOTE) {
+ } else if (note.type === constants.DIFF_NOTE && !note.base_discussion) {
debouncedFetchDiscussions(state.currentlyFetchingDiscussions);
} else {
commit(types.ADD_NEW_NOTE, note);
diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js
index 6c11d53dba3..7cc619ec1c5 100644
--- a/app/assets/javascripts/notes/stores/mutations.js
+++ b/app/assets/javascripts/notes/stores/mutations.js
@@ -11,24 +11,30 @@ export default {
const isDiscussion = type === constants.DISCUSSION_NOTE || type === constants.DIFF_NOTE;
if (!exists) {
- const noteData = {
- expanded: true,
- id: discussion_id,
- individual_note: !isDiscussion,
- notes: [note],
- reply_id: discussion_id,
- };
-
- if (isDiscussion && isInMRPage()) {
- noteData.resolvable = note.resolvable;
- noteData.resolved = false;
- noteData.active = true;
- noteData.resolve_path = note.resolve_path;
- noteData.resolve_with_issue_path = note.resolve_with_issue_path;
- noteData.diff_discussion = false;
+ let discussion = data.discussion || note.base_discussion;
+
+ if (!discussion) {
+ discussion = {
+ expanded: true,
+ id: discussion_id,
+ individual_note: !isDiscussion,
+ reply_id: discussion_id,
+ };
+
+ if (isDiscussion && isInMRPage()) {
+ discussion.resolvable = note.resolvable;
+ discussion.resolved = false;
+ discussion.active = true;
+ discussion.resolve_path = note.resolve_path;
+ discussion.resolve_with_issue_path = note.resolve_with_issue_path;
+ discussion.diff_discussion = false;
+ }
}
- state.discussions.push(noteData);
+ note.base_discussion = undefined; // No point keeping a reference to this
+ discussion.notes = [note];
+
+ state.discussions.push(discussion);
}
},