Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/Ajax/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ public function viewPortData($change)
*
* Variables used:
* - cacheid: (string) The browser (ViewPort) cache identifier.
* - forceUpdate: (integer) If 1, forces an update.
* - forceUpdate: (integer) If 1, forces an update. Accepted at
* either the top level (as sent by IMP.poll()) or
* nested under 'viewport' as 'force'.
*
* @param boolean $rw Open mailbox as READ+WRITE?
*
Expand All @@ -278,8 +280,13 @@ public function viewPortData($change)
*/
public function changed($rw = null)
{
/* Forced viewport return. */
if ($this->_vars->viewport->force) {
/* Forced viewport return. Accept both the nested viewport->force
* flag and the top-level forceUpdate flag: the dynamic view sends
* forceUpdate=1 from IMP.poll(true) (e.g. the search_refresh
* toolbar button) and IMP_Ajax_Application_Handler_Common::viewPort()
* sets vars->forceUpdate after a sort change to re-run search
* mailboxes. */
if ($this->_vars->viewport->force || $this->_vars->forceUpdate) {
return true;
}

Expand Down
19 changes: 18 additions & 1 deletion lib/Ajax/Application/Handler/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,24 @@ public function poll()
* separate poll action because there are other tasks done when
* specifically requesting a poll. */

$this->_base->queue->quota($this->_base->indices->mailbox, false);
$mailbox = $this->_base->indices->mailbox;

/* If the user forced a poll on a search mailbox (e.g. clicked the
* search_refresh toolbar button on the Virtual INBOX), the search
* cacheid alone will not advance because it is derived from the
* query generation counter which is only bumped by mutations.
* Invalidate the underlying query and rebuild its mailbox list so
* changed() can see fresh state and the viewport gets repopulated. */
if (($this->vars->forceUpdate || $this->vars->viewport->force) &&
$mailbox->search) {
$imp_search = $GLOBALS['injector']->getInstance('IMP_Search');
if (isset($imp_search[strval($mailbox)])) {
$imp_search[strval($mailbox)]->invalidateCache();
$mailbox->list_ob->rebuild(true);
}
}

$this->_base->queue->quota($mailbox, false);

if ($this->_base->changed()) {
$this->_base->addTask('viewport', $this->_base->viewPortData(true));
Expand Down
Loading