]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
return a 409 Conflict when subscription already exists
authorEvan Prodromou <evan@status.net>
Mon, 17 Jan 2011 20:57:04 +0000 (15:57 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 17 Jan 2011 20:57:04 +0000 (15:57 -0500)
actions/atompubsubscriptionfeed.php

index 15ae79f6a6c5782bd9ec9977d72d2994ddcd81ee..b319f8dc03e37e67b051f0267b42135b5a6f2487 100644 (file)
@@ -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));