diff options
author | Phil Hughes <me@iamphill.com> | 2019-02-18 09:15:13 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-02-18 09:15:13 +0000 |
commit | 6293786e155413db4ff5a2c42676860eee9740dd (patch) | |
tree | 9402a8ff8487a11e275801755f1c58e345f69d8c /app/assets | |
parent | f1b73619d6784c44b3486a393570da12add03b3a (diff) | |
parent | 5e137b58ca15f224a3b1b05999e6e689b463417a (diff) | |
download | gitlab-ce-6293786e155413db4ff5a2c42676860eee9740dd.tar.gz |
Merge branch '57123-revert-single-comments-to-initial-state-after-cancelling-reply' into 'master'
Resolve "Revert single comments to initial state after cancelling reply"
Closes #57123
See merge request gitlab-org/gitlab-ce!25339
Diffstat (limited to 'app/assets')
4 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index 01f9caa2d5b..47054e337a7 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -253,6 +253,7 @@ export default { 'removePlaceholderNotes', 'toggleResolveNote', 'expandDiscussion', + 'removeConvertedDiscussion', ]), truncateSha, componentName(note) { @@ -292,6 +293,10 @@ export default { } } + if (this.convertedDisscussionIds.includes(this.discussion.id)) { + this.removeConvertedDiscussion(this.discussion.id); + } + this.isReplying = false; this.resetAutoSave(); }, diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 1ae8b9a0686..1a0dba69a7c 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -443,5 +443,8 @@ export const submitSuggestion = ( export const convertToDiscussion = ({ commit }, noteId) => commit(types.CONVERT_TO_DISCUSSION, noteId); +export const removeConvertedDiscussion = ({ commit }, noteId) => + commit(types.REMOVE_CONVERTED_DISCUSSION, noteId); + // prevent babel-plugin-rewire from generating an invalid default during karma tests export default () => {}; diff --git a/app/assets/javascripts/notes/stores/mutation_types.js b/app/assets/javascripts/notes/stores/mutation_types.js index 2bffedad336..796370920bb 100644 --- a/app/assets/javascripts/notes/stores/mutation_types.js +++ b/app/assets/javascripts/notes/stores/mutation_types.js @@ -18,6 +18,7 @@ export const SET_NOTES_LOADING_STATE = 'SET_NOTES_LOADING_STATE'; export const DISABLE_COMMENTS = 'DISABLE_COMMENTS'; export const APPLY_SUGGESTION = 'APPLY_SUGGESTION'; export const CONVERT_TO_DISCUSSION = 'CONVERT_TO_DISCUSSION'; +export const REMOVE_CONVERTED_DISCUSSION = 'REMOVE_CONVERTED_DISCUSSION'; // DISCUSSION export const COLLAPSE_DISCUSSION = 'COLLAPSE_DISCUSSION'; diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js index 23ef843bb75..ae6f8b7790a 100644 --- a/app/assets/javascripts/notes/stores/mutations.js +++ b/app/assets/javascripts/notes/stores/mutations.js @@ -269,4 +269,11 @@ export default { const convertedDisscussionIds = [...state.convertedDisscussionIds, discussionId]; Object.assign(state, { convertedDisscussionIds }); }, + + [types.REMOVE_CONVERTED_DISCUSSION](state, discussionId) { + const convertedDisscussionIds = [...state.convertedDisscussionIds]; + + convertedDisscussionIds.splice(convertedDisscussionIds.indexOf(discussionId), 1); + Object.assign(state, { convertedDisscussionIds }); + }, }; |