if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(
- _('API method not found!'),
+ _('API method not found.'),
404,
$this->format
);
return;
}
- // Do not allow unsubscribing from yourself!
+ // Don't allow unsubscribing from yourself!
if ($this->user->id == $this->other->id) {
$this->clientError(
- _("You cannot unfollow yourself!"),
+ _("You cannot unfollow yourself."),
403,
$this->format
);
return;
}
- $result = subs_unsubscribe_user($this->user, $this->other->nickname);
-
- if (is_string($result)) {
- $this->clientError($result, 403, $this->format);
- return;
- }
+ // throws an exception on error
+ Subscription::cancel($this->user->getProfile(),
+ $this->other->getProfile());
$this->initDocument($this->format);
$this->showProfile($this->other, $this->format);