From: Evan Prodromou Date: Mon, 17 Jan 2011 20:57:04 +0000 (-0500) Subject: return a 409 Conflict when subscription already exists X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6d429ce3579fbbaef120140f4c2c5eae5a2bccf5;p=quix0rs-gnu-social.git return a 409 Conflict when subscription already exists --- diff --git a/actions/atompubsubscriptionfeed.php b/actions/atompubsubscriptionfeed.php index 15ae79f6a6..b319f8dc03 100644 --- a/actions/atompubsubscriptionfeed.php +++ b/actions/atompubsubscriptionfeed.php @@ -263,6 +263,14 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction return; } + if (Subscription::exists($this->_profile, $profile)) { + // 409 Conflict + $this->clientError(sprintf(_('Already subscribed to %s'), + $person->id), + 409); + return; + } + if (Subscription::start($this->_profile, $profile)) { $sub = Subscription::pkeyGet(array('subscriber' => $this->_profile->id, 'subscribed' => $profile->id));