From 6d429ce3579fbbaef120140f4c2c5eae5a2bccf5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 17 Jan 2011 15:57:04 -0500 Subject: [PATCH] return a 409 Conflict when subscription already exists --- actions/atompubsubscriptionfeed.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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)); -- 2.39.5