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:
Diffstat (limited to 'app/assets/javascripts/notes/stores/mutations.js')
-rw-r--r--app/assets/javascripts/notes/stores/mutations.js38
1 files changed, 22 insertions, 16 deletions
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);
}
},