Skip to content

Commit

Permalink
[mms] Fix regression where auto-saved drafts were not being deleted w…
Browse files Browse the repository at this point in the history
…hen cancelling compose message in dynamic view.
  • Loading branch information
slusarz authored and mrubinsk committed Nov 14, 2013
1 parent 52a94b0 commit ea6ec87
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions imp/docs/CHANGES
Expand Up @@ -2,6 +2,8 @@
v6.1.6-git
----------

[mms] Fix regression where auto-saved drafts were not being deleted when
cancelling compose message in dynamic view.
[mms] Fix regression in parsing permission values (Bug #12812).
[mms] Fix regression in showing non-available actions in dynamic mailbox view
when ACL rules prevent them (Bug #12808).
Expand Down
1 change: 1 addition & 0 deletions imp/lib/Ajax/Application/Handler/Draft.php
Expand Up @@ -95,6 +95,7 @@ protected function _draftAction($action)
}

$opts = array(
'autosave' => ($action == 'autoSaveDraft'),
'html' => $this->vars->html,
'priority' => $this->vars->priority,
'readreceipt' => $this->vars->request_read_receipt
Expand Down
13 changes: 12 additions & 1 deletion imp/lib/Compose.php
Expand Up @@ -141,6 +141,12 @@ public function destroy($action)
return;

case 'cancel':
if ($this->getMetadata('draft_auto')) {
$this->destroy('discard');
return;
}
// Fall-through

default:
// No-op
break;
Expand Down Expand Up @@ -173,9 +179,12 @@ public function getMetadata($name)
* Horde_Mime_Part object that contains the text
* to send.
* @param array $opts An array of options w/the following keys:
* <pre>
* - autosave: (boolean) Is this an auto-saved draft?
* - html: (boolean) Is this an HTML message?
* - priority: (string) The message priority ('high', 'normal', 'low').
* - readreceipt: (boolean) Add return receipt headers?
* </pre>
*
* @return string Notification text on success (not HTML encoded).
*
Expand All @@ -184,7 +193,9 @@ public function getMetadata($name)
public function saveDraft($headers, $message, array $opts = array())
{
$body = $this->_saveDraftMsg($headers, $message, $opts);
return $this->_saveDraftServer($body);
$ret = $this->_saveDraftServer($body);
$this->_metadata['draft_auto'] = !empty($opts['autosave']);
return $ret;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions imp/package.xml
Expand Up @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [mms] Fix regression where auto-saved drafts were not being deleted when cancelling compose message in dynamic view.
* [mms] Fix regression in parsing permission values (Bug #12812).
* [mms] Fix regression in showing non-available actions in dynamic mailbox view when ACL rules prevent them (Bug #12808).
</notes>
Expand Down Expand Up @@ -3311,6 +3312,7 @@
<date>2013-10-29</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [mms] Fix regression where auto-saved drafts were not being deleted when cancelling compose message in dynamic view.
* [mms] Fix regression in parsing permission values (Bug #12812).
* [mms] Fix regression in showing non-available actions in dynamic mailbox view when ACL rules prevent them (Bug #12808).
</notes>
Expand Down

0 comments on commit ea6ec87

Please sign in to comment.