Fix duplicate messages in the Drafts folder.

This commit is contained in:
RainLoop Team 2013-12-12 23:33:41 +04:00
parent abc821c461
commit be150d7fc9
5 changed files with 16 additions and 50 deletions

View file

@ -324,7 +324,6 @@ WebMailAjaxRemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sF
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sMessageFolder * @param {string} sMessageFolder
* @param {string} sMessageUid * @param {string} sMessageUid
* @param {string} sMessageID
* @param {string} sDraftFolder * @param {string} sDraftFolder
* @param {string} sFrom * @param {string} sFrom
* @param {string} sTo * @param {string} sTo
@ -338,13 +337,12 @@ WebMailAjaxRemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sF
* @param {string} sInReplyTo * @param {string} sInReplyTo
* @param {string} sReferences * @param {string} sReferences
*/ */
WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sMessageID, sDraftFolder, WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences) sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
{ {
this.defaultRequest(fCallback, 'SaveMessage', { this.defaultRequest(fCallback, 'SaveMessage', {
'MessageFolder': sMessageFolder, 'MessageFolder': sMessageFolder,
'MessageUid': sMessageUid, 'MessageUid': sMessageUid,
'MessageID': sMessageID,
'DraftFolder': sDraftFolder, 'DraftFolder': sDraftFolder,
'From': sFrom, 'From': sFrom,
'To': sTo, 'To': sTo,
@ -364,7 +362,6 @@ WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFo
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sMessageFolder * @param {string} sMessageFolder
* @param {string} sMessageUid * @param {string} sMessageUid
* @param {string} sMessageID
* @param {string} sSentFolder * @param {string} sSentFolder
* @param {string} sFrom * @param {string} sFrom
* @param {string} sTo * @param {string} sTo
@ -378,13 +375,12 @@ WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFo
* @param {string} sInReplyTo * @param {string} sInReplyTo
* @param {string} sReferences * @param {string} sReferences
*/ */
WebMailAjaxRemoteStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sMessageID, sSentFolder, 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)
{ {
this.defaultRequest(fCallback, 'SendMessage', { this.defaultRequest(fCallback, 'SendMessage', {
'MessageFolder': sMessageFolder, 'MessageFolder': sMessageFolder,
'MessageUid': sMessageUid, 'MessageUid': sMessageUid,
'MessageID': sMessageID,
'SentFolder': sSentFolder, 'SentFolder': sSentFolder,
'From': sFrom, 'From': sFrom,
'To': sTo, 'To': sTo,

View file

@ -52,7 +52,6 @@ function PopupsComposeViewModel()
this.draftFolder = ko.observable(''); this.draftFolder = ko.observable('');
this.draftUid = ko.observable(''); this.draftUid = ko.observable('');
this.draftID = ko.observable('');
this.sending = ko.observable(false); this.sending = ko.observable(false);
this.saving = ko.observable(false); this.saving = ko.observable(false);
this.attachments = ko.observableArray([]); this.attachments = ko.observableArray([]);
@ -74,7 +73,7 @@ function PopupsComposeViewModel()
}, this); }, this);
this.isDraftFolderMessage = ko.computed(function () { this.isDraftFolderMessage = ko.computed(function () {
return '' !== this.draftFolder() && '' !== this.draftUid() && '' !== this.draftID(); return '' !== this.draftFolder() && '' !== this.draftUid();
}, this); }, this);
this.composeUploaderButton = ko.observable(null); this.composeUploaderButton = ko.observable(null);
@ -274,7 +273,6 @@ function PopupsComposeViewModel()
this.sendMessageResponse, this.sendMessageResponse,
this.draftFolder(), this.draftFolder(),
this.draftUid(), this.draftUid(),
this.draftID(),
sSentFolder, sSentFolder,
this.currentIdentityResultEmail(), this.currentIdentityResultEmail(),
sTo, sTo,
@ -310,7 +308,6 @@ function PopupsComposeViewModel()
this.saveMessageResponse, this.saveMessageResponse,
this.draftFolder(), this.draftFolder(),
this.draftUid(), this.draftUid(),
this.draftID(),
RL.data().draftFolder(), RL.data().draftFolder(),
this.currentIdentityResultEmail(), this.currentIdentityResultEmail(),
this.to(), this.to(),
@ -528,7 +525,6 @@ PopupsComposeViewModel.prototype.saveMessageResponse = function (sResult, oData)
this.draftFolder(oData.Result.NewFolder); this.draftFolder(oData.Result.NewFolder);
this.draftUid(oData.Result.NewUid); this.draftUid(oData.Result.NewUid);
this.draftID(oData.Result.NewID);
if (this.modalVisibility()) if (this.modalVisibility())
{ {
@ -688,7 +684,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
this.draftFolder(oMessage.folderFullNameRaw); this.draftFolder(oMessage.folderFullNameRaw);
this.draftUid(oMessage.uid); this.draftUid(oMessage.uid);
this.draftID(oMessage.messageId());
this.subject(sSubject); this.subject(sSubject);
this.prepearMessageAttachments(oMessage, sComposeType); this.prepearMessageAttachments(oMessage, sComposeType);
@ -1350,7 +1345,6 @@ PopupsComposeViewModel.prototype.reset = function ()
this.draftFolder(''); this.draftFolder('');
this.draftUid(''); this.draftUid('');
this.draftID('');
this.sending(false); this.sending(false);
this.saving(false); this.saving(false);

View file

@ -3527,11 +3527,10 @@ class Actions
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Account $oAccount
* @param bool $bWithDraftInfo = true * @param bool $bWithDraftInfo = true
* @param string $sMessageID = ''
* *
* @return \MailSo\Mime\Message * @return \MailSo\Mime\Message
*/ */
private function buildMessage($oAccount, $bWithDraftInfo = true, $sMessageID = '') private function buildMessage($oAccount, $bWithDraftInfo = true)
{ {
$sFrom = $this->GetActionParam('From', ''); $sFrom = $this->GetActionParam('From', '');
$sTo = $this->GetActionParam('To', ''); $sTo = $this->GetActionParam('To', '');
@ -3547,14 +3546,7 @@ class Actions
$sReferences = $this->GetActionParam('References', ''); $sReferences = $this->GetActionParam('References', '');
$oMessage = \MailSo\Mime\Message::NewInstance(); $oMessage = \MailSo\Mime\Message::NewInstance();
if (empty($sMessageID))
{
$oMessage->RegenerateMessageId(); $oMessage->RegenerateMessageId();
}
else
{
$oMessage->SetMessageId($sMessageID);
}
$oMessage->SetXMailer('RainLoop/'.APP_VERSION); $oMessage->SetXMailer('RainLoop/'.APP_VERSION);
@ -3696,7 +3688,6 @@ class Actions
$sMessageFolder = $this->GetActionParam('MessageFolder', ''); $sMessageFolder = $this->GetActionParam('MessageFolder', '');
$sMessageUid = $this->GetActionParam('MessageUid', ''); $sMessageUid = $this->GetActionParam('MessageUid', '');
$sMessageID = $this->GetActionParam('MessageID', '');
$sDraftFolder = $this->GetActionParam('DraftFolder', ''); $sDraftFolder = $this->GetActionParam('DraftFolder', '');
if (0 === strlen($sDraftFolder)) if (0 === strlen($sDraftFolder))
@ -3704,7 +3695,7 @@ class Actions
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError);
} }
$oMessage = $this->buildMessage($oAccount, true, $sMessageID); $oMessage = $this->buildMessage($oAccount, true);
$this->Plugins() $this->Plugins()
->RunHook('filter.save-message', array(&$oMessage)) ->RunHook('filter.save-message', array(&$oMessage))
@ -3747,8 +3738,7 @@ class Actions
{ {
$mResult = array( $mResult = array(
'NewFolder' => $sDraftFolder, 'NewFolder' => $sDraftFolder,
'NewUid' => $iNewUid, 'NewUid' => $iNewUid
'NewID' => $sMessageId
); );
} }
} }
@ -3766,11 +3756,10 @@ class Actions
$sDraftFolder = $this->GetActionParam('MessageFolder', ''); $sDraftFolder = $this->GetActionParam('MessageFolder', '');
$sDraftUid = $this->GetActionParam('MessageUid', ''); $sDraftUid = $this->GetActionParam('MessageUid', '');
$sMessageID = $this->GetActionParam('MessageID', '');
$sSentFolder = $this->GetActionParam('SentFolder', ''); $sSentFolder = $this->GetActionParam('SentFolder', '');
$aDraftInfo = $this->GetActionParam('DraftInfo', null); $aDraftInfo = $this->GetActionParam('DraftInfo', null);
$oMessage = $this->buildMessage($oAccount, false, $sMessageID); $oMessage = $this->buildMessage($oAccount, false);
$this->Plugins() $this->Plugins()
->RunHook('filter.send-message', array(&$oMessage)) ->RunHook('filter.send-message', array(&$oMessage))

View file

@ -7896,7 +7896,6 @@ function PopupsComposeViewModel()
this.draftFolder = ko.observable(''); this.draftFolder = ko.observable('');
this.draftUid = ko.observable(''); this.draftUid = ko.observable('');
this.draftID = ko.observable('');
this.sending = ko.observable(false); this.sending = ko.observable(false);
this.saving = ko.observable(false); this.saving = ko.observable(false);
this.attachments = ko.observableArray([]); this.attachments = ko.observableArray([]);
@ -7918,7 +7917,7 @@ function PopupsComposeViewModel()
}, this); }, this);
this.isDraftFolderMessage = ko.computed(function () { this.isDraftFolderMessage = ko.computed(function () {
return '' !== this.draftFolder() && '' !== this.draftUid() && '' !== this.draftID(); return '' !== this.draftFolder() && '' !== this.draftUid();
}, this); }, this);
this.composeUploaderButton = ko.observable(null); this.composeUploaderButton = ko.observable(null);
@ -8118,7 +8117,6 @@ function PopupsComposeViewModel()
this.sendMessageResponse, this.sendMessageResponse,
this.draftFolder(), this.draftFolder(),
this.draftUid(), this.draftUid(),
this.draftID(),
sSentFolder, sSentFolder,
this.currentIdentityResultEmail(), this.currentIdentityResultEmail(),
sTo, sTo,
@ -8154,7 +8152,6 @@ function PopupsComposeViewModel()
this.saveMessageResponse, this.saveMessageResponse,
this.draftFolder(), this.draftFolder(),
this.draftUid(), this.draftUid(),
this.draftID(),
RL.data().draftFolder(), RL.data().draftFolder(),
this.currentIdentityResultEmail(), this.currentIdentityResultEmail(),
this.to(), this.to(),
@ -8372,7 +8369,6 @@ PopupsComposeViewModel.prototype.saveMessageResponse = function (sResult, oData)
this.draftFolder(oData.Result.NewFolder); this.draftFolder(oData.Result.NewFolder);
this.draftUid(oData.Result.NewUid); this.draftUid(oData.Result.NewUid);
this.draftID(oData.Result.NewID);
if (this.modalVisibility()) if (this.modalVisibility())
{ {
@ -8532,7 +8528,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
this.draftFolder(oMessage.folderFullNameRaw); this.draftFolder(oMessage.folderFullNameRaw);
this.draftUid(oMessage.uid); this.draftUid(oMessage.uid);
this.draftID(oMessage.messageId());
this.subject(sSubject); this.subject(sSubject);
this.prepearMessageAttachments(oMessage, sComposeType); this.prepearMessageAttachments(oMessage, sComposeType);
@ -9194,7 +9189,6 @@ PopupsComposeViewModel.prototype.reset = function ()
this.draftFolder(''); this.draftFolder('');
this.draftUid(''); this.draftUid('');
this.draftID('');
this.sending(false); this.sending(false);
this.saving(false); this.saving(false);
@ -14309,7 +14303,6 @@ WebMailAjaxRemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sF
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sMessageFolder * @param {string} sMessageFolder
* @param {string} sMessageUid * @param {string} sMessageUid
* @param {string} sMessageID
* @param {string} sDraftFolder * @param {string} sDraftFolder
* @param {string} sFrom * @param {string} sFrom
* @param {string} sTo * @param {string} sTo
@ -14323,13 +14316,12 @@ WebMailAjaxRemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sF
* @param {string} sInReplyTo * @param {string} sInReplyTo
* @param {string} sReferences * @param {string} sReferences
*/ */
WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sMessageID, sDraftFolder, WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences) sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
{ {
this.defaultRequest(fCallback, 'SaveMessage', { this.defaultRequest(fCallback, 'SaveMessage', {
'MessageFolder': sMessageFolder, 'MessageFolder': sMessageFolder,
'MessageUid': sMessageUid, 'MessageUid': sMessageUid,
'MessageID': sMessageID,
'DraftFolder': sDraftFolder, 'DraftFolder': sDraftFolder,
'From': sFrom, 'From': sFrom,
'To': sTo, 'To': sTo,
@ -14349,7 +14341,6 @@ WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFo
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sMessageFolder * @param {string} sMessageFolder
* @param {string} sMessageUid * @param {string} sMessageUid
* @param {string} sMessageID
* @param {string} sSentFolder * @param {string} sSentFolder
* @param {string} sFrom * @param {string} sFrom
* @param {string} sTo * @param {string} sTo
@ -14363,13 +14354,12 @@ WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFo
* @param {string} sInReplyTo * @param {string} sInReplyTo
* @param {string} sReferences * @param {string} sReferences
*/ */
WebMailAjaxRemoteStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sMessageID, sSentFolder, 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)
{ {
this.defaultRequest(fCallback, 'SendMessage', { this.defaultRequest(fCallback, 'SendMessage', {
'MessageFolder': sMessageFolder, 'MessageFolder': sMessageFolder,
'MessageUid': sMessageUid, 'MessageUid': sMessageUid,
'MessageID': sMessageID,
'SentFolder': sSentFolder, 'SentFolder': sSentFolder,
'From': sFrom, 'From': sFrom,
'To': sTo, 'To': sTo,
@ -15669,9 +15659,6 @@ function RainLoopApp()
this.oRemote = null; this.oRemote = null;
this.oCache = null; this.oCache = null;
this.iSuggestionsLimit = Utils.pInt(this.settingsGet('SuggestionsLimit'));
this.iSuggestionsLimit = 0 === this.iSuggestionsLimit ? 20 : this.iSuggestionsLimit;
this.quotaDebounce = _.debounce(this.quota, 1000 * 30); this.quotaDebounce = _.debounce(this.quota, 1000 * 30);
$.wakeUp(function () { $.wakeUp(function () {

File diff suppressed because one or more lines are too long