diff options
author | Phil Hughes <me@iamphill.com> | 2018-09-14 16:51:25 +0100 |
---|---|---|
committer | André Luís <aluis@gitlab.com> | 2018-09-21 11:59:41 +0100 |
commit | 2497c29ef0d1e178c8b3aa96e8304ee6765bae4e (patch) | |
tree | af895b8945ee8f7ae88c18826385538f10cb171e /app/assets/javascripts/notes/stores/mutations.js | |
parent | 2036458e150db2840dbb1219f1cb5e079b648deb (diff) | |
download | gitlab-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.js | 3 |
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; |