Simplify threads filtering

This commit is contained in:
Dmitriy Simushev 2014-10-22 13:40:44 +00:00
parent 367d8c81fd
commit f2619bb105

View File

@ -74,17 +74,15 @@ class Plugin extends AbstractPlugin implements PluginInterface
*/
public function alterThreads(&$args)
{
$modified = false;
foreach ($args['threads'] as $key => $thread) {
$threads = array();
foreach ($args['threads'] as $thread) {
if ($thread['ban']) {
unset($args['threads'][$key]);
$modified = true;
// Skip banned threads
continue;
}
$threads[] = $thread;
}
if ($modified) {
// Keep keys of the array serial.
$args['threads'] = array_values($args['threads']);
}
$args['threads'] = $threads;
}
}