summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/stores/mutations.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-09-14 16:51:25 +0100
committerAndré Luís <aluis@gitlab.com>2018-09-21 11:59:41 +0100
commit2497c29ef0d1e178c8b3aa96e8304ee6765bae4e (patch)
treeaf895b8945ee8f7ae88c18826385538f10cb171e /app/assets/javascripts/notes/stores/mutations.js
parent2036458e150db2840dbb1219f1cb5e079b648deb (diff)
downloadgitlab-ce-2497c29ef0d1e178c8b3aa96e8304ee6765bae4e.tar.gz
Use returned discussion from API
We now use the returned discussion instead of re-fetching all of the discussions and filtering out the ones we don't need. This speeds up the process of creating a diff discussions by saving us another API request before we can render the discussion
Diffstat (limited to 'app/assets/javascripts/notes/stores/mutations.js')
-rw-r--r--app/assets/javascripts/notes/stores/mutations.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js
index f1242a0d8be..73e55705f39 100644
--- a/app/assets/javascripts/notes/stores/mutations.js
+++ b/app/assets/javascripts/notes/stores/mutations.js
@@ -4,7 +4,8 @@ import * as constants from '../constants';
import { isInMRPage } from '../../lib/utils/common_utils';
export default {
- [types.ADD_NEW_NOTE](state, note) {
+ [types.ADD_NEW_NOTE](state, data) {
+ const note = data.discussion ? data.discussion.notes[0] : data;
const { discussion_id, type } = note;
const [exists] = state.discussions.filter(n => n.id === note.discussion_id);
const isDiscussion = type === constants.DISCUSSION_NOTE || type === constants.DIFF_NOTE;