Skip to content

Commit

Permalink
Add addChangedFlag()
Browse files Browse the repository at this point in the history
This should be run by display code (not library code), and only by code
that uses it (this is not used on message page).
  • Loading branch information
slusarz committed Jan 15, 2015
1 parent 3ecf6d8 commit 180045a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions imp/lib/Ajax/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ public function message(IMP_Indices $indices, array $opts = array())
$show_msg = new IMP_Contents_Message($indices, !empty($opts['peek']));
$msg = (object)$show_msg->showMessage();

$show_msg->addChangedFlag();

/* Need to grab cached inline scripts. */
Horde::startBuffer();
$page_output->outputInlineScript(true);
Expand Down
27 changes: 21 additions & 6 deletions imp/lib/Contents/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ public function showMessage()
$part_info = $this->part_info;
$show_parts = $prefs->getValue('parts_display');

list($mbox,) = $this->_indices->getSingle();

/* Do MDN processing now. */
switch ($registry->getView()) {
case $registry::VIEW_DYNAMIC:
Expand Down Expand Up @@ -262,15 +260,32 @@ public function showMessage()
)
)->setRaw(true);

return $result;
}

/**
* Add changed flag information to the AJAX queue output, if necessary.
*/
public function addChangedFlag()
{
global $injector;

/* Add changed flag information. */
list($mbox,) = $this->_indices->getSingle();
if (!$this->_peek && $mbox->is_imap) {
$status = $mbox->imp_imap->status($mbox, Horde_Imap_Client::STATUS_PERMFLAGS);
$status = $mbox->imp_imap->status(
$mbox,
Horde_Imap_Client::STATUS_PERMFLAGS
);

if (in_array(Horde_Imap_Client::FLAG_SEEN, $status['permflags'])) {
$ajax_queue->flag(array(Horde_Imap_Client::FLAG_SEEN), true, $this->_indices);
$injector->getInstance('IMP_Ajax_Queue')->flag(
array(Horde_Imap_Client::FLAG_SEEN),
true,
$this->_indices
);
}
}

return $result;
}

/**
Expand Down

0 comments on commit 180045a

Please sign in to comment.