Make it impossible to delete self-subscriptions via the API

This commit is contained in:
Zach Copley 2009-09-15 12:59:32 -07:00
parent 5bad7040b1
commit 4081ed79b0

View File

@ -99,6 +99,12 @@ class TwitapifriendshipsAction extends TwitterapiAction
$other = $this->get_profile($id); $other = $this->get_profile($id);
$user = $apidata['user']; // Alwyas the auth user $user = $apidata['user']; // Alwyas the auth user
if ($user->id == $other->id) {
$this->clientError(_("You cannot unfollow yourself!"),
403, $apidata['content-type']);
return;
}
$sub = new Subscription(); $sub = new Subscription();
$sub->subscriber = $user->id; $sub->subscriber = $user->id;
$sub->subscribed = $other->id; $sub->subscribed = $other->id;