removes error in blocked-feed when we haven't blocked anyone

This commit is contained in:
Hannes Mannerheim 2016-02-16 19:20:44 +01:00
parent 4be6c25996
commit 0f9ec45a06
2 changed files with 15 additions and 6 deletions

View File

@ -109,14 +109,18 @@ class ApiQvitterBlocksAction extends ApiPrivateAuthAction
$blocks = QvitterBlocked::getBlocked($this->target->id, $offset, $limit);
$profiles = array();
if($blocks) {
$profiles = array();
while ($blocks->fetch()) {
$this_profile_block = clone($blocks);
$profiles[] = $this->getTargetProfile($this_profile_block->blocked);
while ($blocks->fetch()) {
$this_profile_block = clone($blocks);
$profiles[] = $this->getTargetProfile($this_profile_block->blocked);
}
return $profiles;
} else {
return false;
}
return $profiles;
}
/**

View File

@ -49,7 +49,12 @@ class QvitterBlocked extends Profile_block
public static function getBlocked($profile_id, $offset = 0, $limit = PROFILES_PER_PAGE)
{
$ids = self::getBlockedIDs($profile_id, $offset, $limit);
return Profile_block::listFind('blocked', $ids);
try {
$blocked = Profile_block::listFind('blocked', $ids);
return $blocked;
} catch(NoResultException $e) {
return false;
}
}