Read Receipt (#41)

This commit is contained in:
RainLoop Team 2014-01-04 04:20:07 +04:00
parent 1dc5a45564
commit b100560cd8
37 changed files with 883 additions and 461 deletions

View file

@ -314,7 +314,7 @@ RainLoopApp.prototype.folderInformation = function (sFolder, aList)
bCheck = true;
oFlags = oData.Result.Flags[sUid];
RL.cache().storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
!oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded']
!oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded'], !!oFlags['IsReadReceipt']
]);
}
}

View file

@ -34,6 +34,7 @@ function MessageModel()
this.flagged = ko.observable(false);
this.answered = ko.observable(false);
this.forwarded = ko.observable(false);
this.isReadReceipt = ko.observable(false);
this.selected = ko.observable(false);
this.checked = ko.observable(false);
@ -89,6 +90,8 @@ function MessageModel()
this.attachments = ko.observableArray([]);
this.priority = ko.observable(Enums.MessagePriority.Normal);
this.readReceipt = ko.observable('');
this.aDraftInfo = [];
this.sMessageId = '';
this.sInReplyTo = '';
@ -242,6 +245,7 @@ MessageModel.prototype.clear = function ()
this.flagged(false);
this.answered(false);
this.forwarded(false);
this.isReadReceipt(false);
this.selected(false);
this.checked(false);
@ -255,6 +259,7 @@ MessageModel.prototype.clear = function ()
this.attachments([]);
this.priority(Enums.MessagePriority.Normal);
this.readReceipt('');
this.aDraftInfo = [];
this.sMessageId = '';
this.sInReplyTo = '';
@ -270,6 +275,17 @@ MessageModel.prototype.clear = function ()
this.lastInCollapsedThreadLoading(false);
};
MessageModel.prototype.computeSenderEmail = function ()
{
var
sSent = RL.data().sentFolder(),
sDraft = RL.data().draftFolder()
;
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toEmailsString() : this.fromEmailString());
};
/**
* @param {AjaxJsonMessage} oJsonMessage
* @return {boolean}
@ -314,17 +330,6 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
return bResult;
};
MessageModel.prototype.computeSenderEmail = function ()
{
var
sSent = RL.data().sentFolder(),
sDraft = RL.data().draftFolder()
;
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toEmailsString() : this.fromEmailString());
};
/**
* @param {AjaxJsonMessage} oJsonMessage
* @return {boolean}
@ -354,6 +359,8 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
this.foundedCIDs = Utils.isArray(oJsonMessage.FoundedCIDs) ? oJsonMessage.FoundedCIDs : [];
this.attachments(this.initAttachmentsFromJson(oJsonMessage.Attachments));
this.readReceipt(oJsonMessage.ReadReceipt || '');
this.computeSenderEmail();
bResult = true;
@ -411,6 +418,7 @@ MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
this.flagged(!!oJsonMessage.IsFlagged);
this.answered(!!oJsonMessage.IsAnswered);
this.forwarded(!!oJsonMessage.IsForwarded);
this.isReadReceipt(!!oJsonMessage.IsReadReceipt);
bResult = true;
}
@ -791,6 +799,7 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
this.flagged(oMessage.flagged());
this.answered(oMessage.answered());
this.forwarded(oMessage.forwarded());
this.isReadReceipt(oMessage.isReadReceipt());
this.selected(oMessage.selected());
this.checked(oMessage.checked());

View file

@ -363,6 +363,26 @@ WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFo
}, Consts.Defaults.SaveMessageAjaxTimeout);
};
/**
* @param {?Function} fCallback
* @param {string} sMessageFolder
* @param {string} sMessageUid
* @param {string} sReadReceipt
* @param {string} sSubject
* @param {string} sText
*/
WebMailAjaxRemoteStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText)
{
this.defaultRequest(fCallback, 'SendReadReceiptMessage', {
'MessageFolder': sMessageFolder,
'MessageUid': sMessageUid,
'ReadReceipt': sReadReceipt,
'Subject': sSubject,
'Text': sText
});
};
/**
* @param {?Function} fCallback
* @param {string} sMessageFolder
@ -379,9 +399,10 @@ WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFo
* @param {(Array|null)} aDraftInfo
* @param {string} sInReplyTo
* @param {string} sReferences
* @param {boolean} bRequestReadReceipt
*/
WebMailAjaxRemoteStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bRequestReadReceipt)
{
this.defaultRequest(fCallback, 'SendMessage', {
'MessageFolder': sMessageFolder,
@ -397,6 +418,7 @@ WebMailAjaxRemoteStorage.prototype.sendMessage = function (fCallback, sMessageFo
'DraftInfo': aDraftInfo,
'InReplyTo': sInReplyTo,
'References': sReferences,
'ReadReceiptRequest': bRequestReadReceipt ? '1' : '0',
'Attachments': aAttachments
}, Consts.Defaults.SendMessageAjaxTimeout);
};

View file

@ -264,12 +264,13 @@ WebMailCacheStorage.prototype.initMessageFlagsFromCache = function (oMessage)
mFlaggedSubUid = null
;
if (aFlags && 4 === aFlags.length)
if (aFlags && 5 === aFlags.length)
{
oMessage.unseen(aFlags[0]);
oMessage.flagged(aFlags[1]);
oMessage.answered(aFlags[2]);
oMessage.forwarded(aFlags[3]);
oMessage.isReadReceipt(aFlags[4]);
}
if (0 < oMessage.threads().length)
@ -300,7 +301,7 @@ WebMailCacheStorage.prototype.storeMessageFlagsToCache = function (oMessage)
this.setMessageFlagsToCache(
oMessage.folderFullNameRaw,
oMessage.uid,
[oMessage.unseen(), oMessage.flagged(), oMessage.answered(), oMessage.forwarded()]
[oMessage.unseen(), oMessage.flagged(), oMessage.answered(), oMessage.forwarded(), oMessage.isReadReceipt()]
);
}
};

View file

@ -167,7 +167,6 @@ html.ssm-state-mobile {
}
}
.ui-resizable-helper {
border-right: 5px solid #777;
border-right-color: rgba(255,255,255,0.7);

View file

@ -1,4 +1,4 @@
showImages
html.rl-no-preview-pane {
.messageView {
@ -181,11 +181,15 @@ html.rl-no-preview-pane {
height: 0px;
}
.showImages {
.showImages, .readReceipt {
cursor: pointer;
background-color: #eee;
padding: 10px 15px;
border-bottom: 1px solid #ccc;
border-bottom: 1px solid #ddd;
background-color: #eee;
}
.readReceipt {
background-color: #ffffd9;
}
.attachmentsPlace {

View file

@ -79,11 +79,6 @@ function MailBoxMessageViewViewModel()
this.viewDate = ko.observable('');
this.viewMoment = ko.observable('');
this.viewLineAsCcc = ko.observable('');
this.viewHasImages = ko.observable(false);
this.viewHasVisibleAttachments = ko.observable(false);
this.viewAttachments = ko.observableArray([]);
this.viewIsHtml = ko.observable(false);
this.viewIsRtl = ko.observable(false);
this.viewViewLink = ko.observable('');
this.viewDownloadLink = ko.observable('');
this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic);
@ -105,11 +100,6 @@ function MailBoxMessageViewViewModel()
this.viewDate(oMessage.fullFormatDateValue());
this.viewMoment(oMessage.momentDate());
this.viewLineAsCcc(oMessage.lineAsCcc());
this.viewHasImages(oMessage.hasImages());
this.viewHasVisibleAttachments(oMessage.hasVisibleAttachments());
this.viewAttachments(oMessage.attachments());
this.viewIsHtml(oMessage.isHtml());
this.viewIsRtl(oMessage.isRtl());
this.viewViewLink(oMessage.viewLink());
this.viewDownloadLink(oMessage.downloadLink());
@ -338,3 +328,22 @@ MailBoxMessageViewViewModel.prototype.showImages = function (oMessage)
oMessage.showExternalImages(true);
}
};
/**
* @param {MessageModel} oMessage
*/
MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
{
if (oMessage && '' !== oMessage.readReceipt())
{
RL.remote().sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
oMessage.readReceipt(),
Utils.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': oMessage.readReceipt()}));
oMessage.isReadReceipt(true);
RL.cache().storeMessageFlagsToCache(oMessage);
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
}
};

View file

@ -38,6 +38,8 @@ function PopupsComposeViewModel()
this.replyTo = ko.observable('');
this.subject = ko.observable('');
this.requestReadReceipt = ko.observable(false);
this.sendError = ko.observable(false);
this.sendSuccessButSaveError = ko.observable(false);
this.savedError = ko.observable(false);
@ -294,7 +296,8 @@ function PopupsComposeViewModel()
this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo,
this.sInReplyTo,
this.sReferences
this.sReferences,
this.requestReadReceipt()
);
}
}
@ -1358,6 +1361,8 @@ PopupsComposeViewModel.prototype.reset = function ()
this.replyTo('');
this.subject('');
this.requestReadReceipt(false);
this.aDraftInfo = null;
this.sInReplyTo = '';
this.bFromDraft = false;