Commit 101a7f37 authored by Phil Hughes's avatar Phil Hughes

Fixed batch comments specs

parent aeec5fa3
......@@ -108,7 +108,6 @@ export default {
async isFetching() {
if (!this.isFetching) {
await this.$nextTick();
await this.updateResolvableDiscussionsCounts();
await this.startTaskList();
await this.checkLocationHash();
}
......@@ -180,7 +179,6 @@ export default {
'convertToDiscussion',
'stopPolling',
'setConfidentiality',
'updateResolvableDiscussionsCounts',
]),
discussionIsIndividualNoteAndNotConverted(discussion) {
return discussion.individual_note && !this.convertedDisscussionIds.includes(discussion.id);
......
......@@ -424,7 +424,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
export const setFetchingState = ({ commit }, fetchingState) =>
commit(types.SET_NOTES_FETCHING_STATE, fetchingState);
const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => {
const pollSuccessCallBack = async (resp, commit, state, getters, dispatch) => {
if (state.isResolvingDiscussion) {
return null;
}
......@@ -437,8 +437,9 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => {
}
if (resp.notes?.length) {
dispatch('updateOrCreateNotes', resp.notes);
await dispatch('updateOrCreateNotes', resp.notes);
dispatch('startTaskList');
dispatch('updateResolvableDiscussionsCounts');
}
commit(types.SET_LAST_FETCHED_AT, resp.last_fetched_at);
......@@ -449,6 +450,7 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => {
const getFetchDataParams = (state) => {
const endpoint = state.notesData.notesPath;
const options = {
params: { t: new Date().getTime() },
headers: {
'X-Last-Fetched-At': state.lastFetchedAt ? `${state.lastFetchedAt}` : undefined,
},
......
......@@ -32,6 +32,23 @@ export default {
}
}
if (
window.gon?.features?.paginatedNotes &&
note.base_discussion &&
type === constants.DIFF_NOTE
) {
if (discussion.diff_file) {
discussion.file_hash = discussion.diff_file.file_hash;
discussion.truncated_diff_lines = utils.prepareDiffLines(
discussion.truncated_diff_lines || [],
);
}
discussion.expanded = note.expanded;
discussion.resolved = note.resolved;
}
// note.base_discussion = undefined; // No point keeping a reference to this
delete note.base_discussion;
discussion.notes = [note];
......
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