Skip to content

Commit

Permalink
Bug #12570: Unselect message when marking as unseen
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Sep 27, 2013
1 parent a6198bd commit 4159549
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions imp/js/dimpbase.js
Expand Up @@ -3159,6 +3159,10 @@ var DimpBase = {
this.updateFlag(s, f, false);
}, this);
}

if (entry.deselect) {
this.viewport.deselect(s);
}
}, this);
}, this);
},
Expand Down
13 changes: 13 additions & 0 deletions imp/lib/Ajax/Queue.php
Expand Up @@ -114,6 +114,7 @@ class IMP_Ajax_Queue
*
* For flag data (key: 'flag'), an array of objects with these properties:
* - add: (array) The list of flags that were added.
* - deselect: (boolean) If true, deselect the uids.
* - remove: (array) The list of flags that were removed.
* - uids: (string) Indices of the messages that have changed (IMAP
* sequence string; mboxes are base64url encoded).
Expand Down Expand Up @@ -336,9 +337,21 @@ public function flag($flags, $add, IMP_Indices $indices)
$result = new stdClass;
if (!empty($changed['add'])) {
$result->add = array_map('strval', $changed['add']);
foreach ($changed['add'] as $val) {
if ($val->deselect(true)) {
$result->deselect = true;
break;
}
}
}
if (!empty($changed['remove'])) {
$result->remove = array_map('strval', $changed['remove']);
foreach ($changed['remove'] as $val) {
if ($val->deselect(false)) {
$result->deselect = true;
break;
}
}
}

$result->buids = $indices->toArray();
Expand Down
12 changes: 12 additions & 0 deletions imp/lib/Flag/Base.php
Expand Up @@ -194,6 +194,18 @@ public function match($data)
return false;
}

/**
* Determine if the message should be deselected after changing.
*
* @param boolean $set Was the flag set?
*
* @return boolean True if messages should be deselected.
*/
public function deselect($set)
{
return false;
}

/**
* Return the flag label.
* Necessary evil as gettext strings can not be set directly to object
Expand Down
7 changes: 7 additions & 0 deletions imp/lib/Flag/Imap/Seen.php
Expand Up @@ -42,4 +42,11 @@ protected function _getLabel()
return _("Seen");
}

/**
*/
public function deselect($set)
{
return !$set;
}

}

0 comments on commit 4159549

Please sign in to comment.