]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/AnonymousFave/actions/anonfavor.php
Merge branch 'nightly' of gitorious.org:social/mainline into nightly
[quix0rs-gnu-social.git] / plugins / AnonymousFave / actions / anonfavor.php
index da8757082e670af92ff01b4f779e6cd4ed8e901a..6ce0e84a16d76347b7d3438eda68d51bbc03c152 100644 (file)
@@ -47,7 +47,7 @@ class AnonFavorAction extends RedirectingAction
      *
      * @return void
      */
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
 
@@ -55,29 +55,15 @@ class AnonFavorAction extends RedirectingAction
 
         if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
             // TRANS: Client error.
-            $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.')
-            );
-            return;
+            $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.'));
         }
 
         $id     = $this->trimmed('notice');
         $notice = Notice::getKV($id);
         $token  = $this->checkSessionToken();
 
-        if ($profile->hasFave($notice)) {
-            // TRANS: Client error.
-            $this->clientError(_m('This notice is already a favorite!'));
-            return;
-        }
-        $fave = Fave::addNew($profile, $notice);
-
-        if (!$fave) {
-            // TRANS: Server error.
-            $this->serverError(_m('Could not create favorite.'));
-            return;
-        }
-
-        $profile->blowFavesCache();
+        // Throws exception
+        $stored = Fave::addNew($profile, $notice);
 
         if ($this->boolean('ajax')) {
             $this->startHTML('text/xml;charset=utf-8');