diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-12 09:57:22 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-12 09:57:22 +0000 |
commit | 63d3581e66acc21b79130c5f13bde88a74d136ac (patch) | |
tree | c87dcbf11adc8ba666ac61cef91fa895265a92d5 /app/assets/javascripts/notes | |
parent | 98e31bf437c9934884bd8a7b5c311617757d0785 (diff) | |
download | gitlab-ce-63d3581e66acc21b79130c5f13bde88a74d136ac.tar.gz |
fixed note polling not sending updated last fetched at datefix-duplicate-notes
added spec for polling
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/services/notes_service.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/actions.js | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/app/assets/javascripts/notes/services/notes_service.js b/app/assets/javascripts/notes/services/notes_service.js index bb31be583c7..b4c19a9ec22 100644 --- a/app/assets/javascripts/notes/services/notes_service.js +++ b/app/assets/javascripts/notes/services/notes_service.js @@ -27,10 +27,11 @@ export default { return Vue.http[method](endpoint); }, poll(data = {}) { - const { endpoint, lastFetchedAt } = data; + const endpoint = data.notesData.notesPath; + const lastFetchedAt = data.lastFetchedAt; const options = { headers: { - 'X-Last-Fetched-At': `${lastFetchedAt}`, + 'X-Last-Fetched-At': lastFetchedAt ? `${lastFetchedAt}` : undefined, }, }; diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 3eaae0bc683..fc7faf05c5f 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -203,12 +203,10 @@ const pollSuccessCallBack = (resp, commit, state, getters) => { }; export const poll = ({ commit, state, getters }) => { - const requestData = { endpoint: state.notesData.notesPath, lastFetchedAt: state.lastFetchedAt }; - eTagPoll = new Poll({ resource: service, method: 'poll', - data: requestData, + data: state, successCallback: resp => resp.json() .then(data => pollSuccessCallBack(data, commit, state, getters)), errorCallback: () => Flash('Something went wrong while fetching latest comments.'), @@ -217,7 +215,7 @@ export const poll = ({ commit, state, getters }) => { if (!Visibility.hidden()) { eTagPoll.makeRequest(); } else { - service.poll(requestData); + service.poll(state); } Visibility.change(() => { |