Skip to content

Commit

Permalink
[mms] Trigger auto save draft in dynamic view if attachments have cha…
Browse files Browse the repository at this point in the history
…nged.
  • Loading branch information
slusarz committed Oct 14, 2013
1 parent 041ac8d commit f48d849
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
1 change: 1 addition & 0 deletions imp/docs/CHANGES
Expand Up @@ -2,6 +2,7 @@
v6.1.5-git
----------

[mms] Trigger auto save draft in dynamic view if attachments have changed.
[mms] SECURITY: Fix XSS in message and search screens resulting from a
user-defined flag label (João Machado <geral@jpaulo.eu>).
[mms] Improved UI for dropping attachments on dynamic compose screen.
Expand Down
47 changes: 32 additions & 15 deletions imp/js/compose-dimp.js
Expand Up @@ -584,27 +584,44 @@ var DimpCompose = {
// Set auto-save-drafts now if not already active.
if (DimpCore.conf.auto_save_interval_val &&
!this.auto_save_interval) {
this.auto_save_interval = new PeriodicalExecuter(function() {
if ($('compose').visible()) {
var hdrs = murmurhash3($('to', 'cc', 'bcc', 'subject').compact().invoke('getValue').join('\0'), this.seed), msg;
if (this.md5_hdrs) {
msg = this.msgHash();
if (this.md5_hdrs != hdrs || this.md5_msg != msg) {
this.uniqueSubmit('autoSaveDraft');
}
} else {
msg = this.md5_msgOrig;
}
this.md5_hdrs = hdrs;
this.md5_msg = msg;
}
}.bind(this), DimpCore.conf.auto_save_interval_val * 60);
this.auto_save_interval = new PeriodicalExecuter(
this.autoSaveDraft.bind(this),
DimpCore.conf.auto_save_interval_val * 60
);

/* Immediately execute to get hash of headers. */
this.auto_save_interval.execute();
}
},

autoSaveDraft: function()
{
var hdrs, msg;

if (!$('compose').visible()) {
return;
}

hdrs = murmurhash3(
[$('to', 'cc', 'bcc', 'subject').compact().invoke('getValue'),
$('attach_list').select('SPAN.attachName').pluck('textContent')
].flatten().join('\0'),
this.seed
);

if (this.md5_hdrs) {
msg = this.msgHash();
if (this.md5_hdrs != hdrs || this.md5_msg != msg) {
this.uniqueSubmit('autoSaveDraft');
}
} else {
msg = this.md5_msgOrig;
}

this.md5_hdrs = hdrs;
this.md5_msg = msg;
},

msgHash: function()
{
return murmurhash3(ImpComposeBase.editor_on ? this.rte.getData() : $F('composeMessage'), this.seed);
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] Trigger auto save draft in dynamic view if attachments have changed.
* [mms] SECURITY: Fix XSS in message and search screens resulting from a user-defined flag label (João Machado &lt;geral@jpaulo.eu&gt;).
* [mms] Improved UI for dropping attachments on dynamic compose screen.
* [mms] Fix manually loading all addresses in a header.
Expand Down Expand Up @@ -3294,6 +3295,7 @@
<date>2013-09-04</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [mms] Trigger auto save draft in dynamic view if attachments have changed.
* [mms] SECURITY: Fix XSS in message and search screens resulting from a user-defined flag label (João Machado &lt;geral@jpaulo.eu&gt;).
* [mms] Improved UI for dropping attachments on dynamic compose screen.
* [mms] Fix manually loading all addresses in a header.
Expand Down

0 comments on commit f48d849

Please sign in to comment.