Avoid to refresh mail list if the active folder is not the Draft folder while saving compose mail as draft

This commit is contained in:
Hadi Nategh 2014-09-22 09:07:48 +00:00
parent c74a2d7501
commit 3e7b572f16
2 changed files with 12 additions and 5 deletions

View File

@ -2430,7 +2430,8 @@ class mail_compose
$response->data(array(
'draftedId' => $draft_id,
'message' => $msg,
'success' => $success
'success' => $success,
'draftfolder' => $this->mail_bo->profileID.mail_ui::$delimiter.$this->mail_bo->getDraftFolder()
));
}

View File

@ -3190,6 +3190,7 @@ app.classes.mail = AppJS.extend(
* -draftedId: new drafted id created by server
* -message: resault message
* -success: true if saving was successful otherwise false
* -draftfolder: Name of draft folder including its delimiter
*
* @param {string} _action action is the element which caused saving draft, it could be as such:
* -button[saveAsDraft]
@ -3201,7 +3202,7 @@ app.classes.mail = AppJS.extend(
//Make sure there's a response from server otherwise shoot an error message
if (jQuery.isEmptyObject(_responseData))
{
this.egw.message('Could not saved the message. Besause, the response from server failed.', 'error');
this.egw.message('Could not saved the message. Because, the response from server failed.', 'error');
return false;
}
@ -3209,17 +3210,22 @@ app.classes.mail = AppJS.extend(
{
var content = this.et2.getArrayMgr('content');
var lastDrafted = this.et2.getWidgetById('lastDrafted');
var folderTree = opener.etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('nm[foldertree]');
var activeFolder = folderTree?folderTree.getSelectedNode():null;
if (content)
{
var prevDraftedId = content.data.lastDrafted;
content.data.lastDrafted = _responseData.draftedId;
this.et2.setArrayMgr('content', content);
lastDrafted.set_value(_responseData.draftedId);
if (prevDraftedId)
if (typeof activeFolder.id !='undefined'&& activeFolder && _responseData.draftfolder == activeFolder.id)
{
opener.egw_refresh(_responseData.message,'mail', prevDraftedId, 'delete');
if (prevDraftedId)
{
opener.egw_refresh(_responseData.message,'mail', prevDraftedId, 'delete');
}
this.egw.refresh(_responseData.message,'mail',_responseData.draftedId);
}
this.egw.refresh(_responseData.message,'mail',_responseData.draftedId);
switch (_action)
{
case 'button[saveAsDraftAndPrint]':