Skip to content

Commit

Permalink
Only send message id information to browser if there is a chance of f…
Browse files Browse the repository at this point in the history
…inding sent message in search
  • Loading branch information
slusarz committed Mar 9, 2015
1 parent cc32c1c commit 9f30856
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
9 changes: 6 additions & 3 deletions imp/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ var ImpCore = {
entry.m.escapeHTML()
);
if (entry.s) {
li = li.wrap('A', {
className: 'imp-maillog-sent'
}).store('msgid', entry.s);
li = li
.wrap('A', {
className: 'imp-maillog-sent'
})
.store('msgid', entry.s)
.store('type', entry.t);
}
df.appendChild(li);
});
Expand Down
6 changes: 3 additions & 3 deletions imp/lib/Ajax/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,14 +806,14 @@ protected function _addMaillogInfo(IMP_Ajax_Application $ajax)
$tmp = array();

foreach ($l as $v3) {
$tmp[] = array(
$tmp[] = array_filter(array(
// 'm' = message
'm' => $v3->message,
// 's' = sent message-id
's' => $v3->msg_id,
's' => $v3->searchMailboxes() ? $v3->msg_id : null,
// 't' = type
't' => $v3->action
);
));
}

if ($tmp) {
Expand Down
26 changes: 26 additions & 0 deletions imp/lib/Maillog/Log/Sentmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,30 @@ public function addData()
)));
}

/**
* Return the mailboxes that can be searched to find the sent message.
*
* @return array Array of arrays; each array is a group of mailboxes to
* search in order of priority.
*/
public function searchMailboxes()
{
$out = array();

$special = IMP_Mailbox::getSpecialMailboxes();

/* Check for sent-mail mailbox(es) first. */
if (!empty($special[IMP_Mailbox::SPECIAL_SENT])) {
$out[] = $special[IMP_Mailbox::SPECIAL_SENT];
}

/* Add trash mailbox as backup. */
if (!empty($special[IMP_Mailbox::SPECIAL_TRASH]) &&
!$special[IMP_Mailbox::SPECIAL_TRASH]->vtrash) {
$out[] = array($special[IMP_Mailbox::SPECIAL_TRASH]);
}

return $out;
}

}

0 comments on commit 9f30856

Please sign in to comment.