Skip to content

Commit

Permalink
Fix synchronization of seen/unseen status of msgs
Browse files Browse the repository at this point in the history
Fixes #2715
  • Loading branch information
cgx committed May 9, 2014
1 parent 1f5a2a4 commit 698524b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions UI/WebServerResources/MailerUI.js
Expand Up @@ -276,11 +276,9 @@ function mailListToggleMessagesRead(row, force_mark_as_read) {

for (var i = 0; i < selectedRowsId.length; i++) {
var msguid = selectedRowsId[i].split('_')[1];
// Assume ajax request will succeed and change message flag in table
markMailInWindow(window, msguid, markread);

// Assume ajax request will succeed and invalidate data cache now.
Mailer.dataTable.invalidate(msguid, true);

var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/"
+ msguid + "/" + action;

Expand All @@ -302,7 +300,10 @@ function mailListMarkMessage(event) {

function mailListMarkMessageCallback(http) {
var data = http.callbackData;
if (!isHttpStatus204(http.status)) {
if (isHttpStatus204(http.status)) {
Mailer.dataTable.invalidate(data["msguid"], true);
}
else {
log("Message Mark Failed (" + http.status + "): " + http.statusText);
Mailer.dataTable.invalidate(data["msguid"], false);
}
Expand Down Expand Up @@ -1634,19 +1635,14 @@ function loadMessageCallback(http) {
loadRemoteImages();
configureSignatureFlagImage();
handleReturnReceipt();
// Warning: If the user can't set the read/unread flag, it won't
// be reflected in the view unless we force the refresh.
if (http.callbackData.seenStateHasChanged)
Mailer.dataTable.dataSource.invalidate(msguid);
}
var cachedMessage = new Array();
cachedMessage['idx'] = Mailer.currentMailbox + '/' + msguid;
cachedMessage['time'] = (new Date()).getTime();
cachedMessage['text'] = http.responseText;
if (cachedMessage['text'].length < 30000)
storeCachedMessage(cachedMessage);

// We mark the mail as read
// Mark the mail as read
mailListToggleMessagesRead($("row_" + msguid), true);
}
}
Expand Down

0 comments on commit 698524b

Please sign in to comment.