diff options
Diffstat (limited to 'app/assets/javascripts/notes/stores')
-rw-r--r-- | app/assets/javascripts/notes/stores/actions.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/getters.js | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 656591e0c32..7eb10f647a0 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -631,7 +631,7 @@ export const submitSuggestion = ( }); }; -export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContainer }) => { +export const submitSuggestionBatch = ({ commit, dispatch, state }, { message, flashContainer }) => { const suggestionIds = state.batchSuggestionsInfo.map(({ suggestionId }) => suggestionId); const resolveAllDiscussions = () => @@ -644,7 +644,7 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai commit(types.SET_RESOLVING_DISCUSSION, true); dispatch('stopPolling'); - return Api.applySuggestionBatch(suggestionIds) + return Api.applySuggestionBatch(suggestionIds, message) .then(() => Promise.all(resolveAllDiscussions())) .then(() => commit(types.CLEAR_SUGGESTION_BATCH)) .catch((err) => { diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index 956221d69ae..a710ac0ccf5 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -283,3 +283,14 @@ export const suggestionsCount = (state, getters) => export const hasDrafts = (state, getters, rootState, rootGetters) => Boolean(rootGetters['batchComments/hasDrafts']); + +export const getSuggestionsFilePaths = (state) => () => + state.batchSuggestionsInfo.reduce((acc, suggestion) => { + const discussion = state.discussions.find((d) => d.id === suggestion.discussionId); + + if (acc.indexOf(discussion?.diff_file?.file_path) === -1) { + acc.push(discussion.diff_file.file_path); + } + + return acc; + }, []); |