function hasBlocked($other)
{
- $block = Profile_block::get($this->id, $other->id);
-
- if (empty($block)) {
- $result = false;
- } else {
- $result = true;
- }
-
- return $result;
+ $block = Profile_block::exists($this, $other);
+ return !empty($block);
}
function getAtomFeed()
);
}
- function get($blocker, $blocked)
+ static function exists(Profile $blocker, Profile $blocked)
{
- return Profile_block::pkeyGet(array('blocker' => $blocker,
- 'blocked' => $blocked));
- }
+ return Profile_block::pkeyGet(array('blocker' => $blocker->id,
+ 'blocked' => $blocked->id));
+ }
}
* Cancel a subscription
*
*/
- function cancel(Profile $subscriber, Profile $other)
+ static function cancel(Profile $subscriber, Profile $other)
{
if (!self::exists($subscriber, $other)) {
// TRANS: Exception thrown when trying to unsibscribe without a subscription.
return;
}
- function exists($subscriber, $other)
+ static function exists(Profile $subscriber, Profile $other)
{
$sub = Subscription::pkeyGet(array('subscriber' => $subscriber->id,
'subscribed' => $other->id));
return true;
}
- function unblock($other)
+ function unblock(Profile $other)
{
// Get the block record
- $block = Profile_block::get($this->id, $other->id);
+ $block = Profile_block::exists($this->getProfile(), $other);
if (!$block) {
return false;
}
// NOTE: Make sure we're scoped properly based on the auths!
- $this->scoped = $this->auth_user->getProfile();
+ if (isset($this->auth_user) && !empty($this->auth_user)) {
+ $this->scoped = $this->auth_user->getProfile();
+ } else {
+ $this->scoped = null;
+ }
// Reject API calls with the wrong access level