Commit 14576c8e authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'fix-design-discussion-comment-bug' into 'master'

Fix inability to add comments to a discussion in Design Management

See merge request gitlab-org/gitlab!21229
parents 3896d1c3 8f15cabc
......@@ -71,7 +71,13 @@ export default {
data: { createNote },
},
) {
updateStoreAfterAddDiscussionComment(store, createNote, getDesignQuery, this.designVariables);
updateStoreAfterAddDiscussionComment(
store,
createNote,
getDesignQuery,
this.designVariables,
this.discussion.id,
);
},
onDone() {
this.discussionComment = '';
......
......@@ -45,14 +45,14 @@ const addNewVersionToStore = (store, query, version) => {
});
};
const addDiscussionCommentToStore = (store, createNote, query, queryVariables) => {
const addDiscussionCommentToStore = (store, createNote, query, queryVariables, discussionId) => {
const data = store.readQuery({
query,
variables: queryVariables,
});
const design = extractDesign(data);
const currentDiscussion = extractCurrentDiscussion(design.discussions, this.discussion.id);
const currentDiscussion = extractCurrentDiscussion(design.discussions, discussionId);
currentDiscussion.node.notes.edges = [
...currentDiscussion.node.notes.edges,
{
......@@ -186,11 +186,17 @@ export const updateStoreAfterDesignsDelete = (store, data, query, designs) => {
}
};
export const updateStoreAfterAddDiscussionComment = (store, data, query, queryVariables) => {
export const updateStoreAfterAddDiscussionComment = (
store,
data,
query,
queryVariables,
discussionId,
) => {
if (data.errors) {
onError(data, ADD_DISCUSSION_COMMENT_ERROR);
} else {
addDiscussionCommentToStore(store, data, query, queryVariables);
addDiscussionCommentToStore(store, data, query, queryVariables, discussionId);
}
};
......
---
title: Fix inability to add comments to a discussion in Design Management
merge_request: 21229
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment