Merge branch 'MDL-67700-master' of git://github.com/ferranrecio/moodle

This commit is contained in:
Andrew Nicols 2020-05-22 10:51:31 +08:00
commit c225a42c19
3 changed files with 17 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -506,6 +506,18 @@ function(
newestFirst,
timeFrom
)
.then(function(result) {
// Prevent older requests from contaminating the current view.
if (result.id != viewState.id) {
result.messages = [];
// Purge old conversation cache to prevent messages lose.
if (result.id in stateCache) {
delete stateCache[result.id];
}
}
return result;
})
.then(function(result) {
if (result.messages.length && ignoreList.length) {
result.messages = result.messages.filter(function(message) {
@ -1865,6 +1877,9 @@ function(
var resetState = function(body, conversationId, loggedInUserProfile) {
// Reset all of the states back to the beginning if we're loading a new
// conversation.
if (newMessagesPollTimer) {
newMessagesPollTimer.stop();
}
loadedAllMessages = false;
messagesOffset = 0;
newMessagesPollTimer = null;
@ -1893,10 +1908,6 @@ function(
viewState = initialState;
}
if (newMessagesPollTimer) {
newMessagesPollTimer.stop();
}
render(initialState);
};