]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Favorite/lib/favcommand.php
Merge commit 'refs/merge-requests/30' of https://gitorious.org/social/mainline into...
[quix0rs-gnu-social.git] / plugins / Favorite / lib / favcommand.php
index c38463f4cd87f98997c3a431a6c616c617d69e89..cf5ca79218ed293377555b7213ea2d92c37748a7 100644 (file)
@@ -25,26 +25,12 @@ class FavCommand extends Command
             return; 
         } 
  
-        $fave = Fave::addNew($this->user->getProfile(), $notice); 
-        if (!$fave) { 
-            // TRANS: Error message text shown when a favorite could not be set. 
-            $channel->error($this->user, _('Could not create favorite.')); 
-            return; 
-        } 
-        // @fixme favorite notification should be triggered 
-        // at a lower level 
-        $other = User::getKV('id', $notice->profile_id); 
-        if ($other && $other->id != $this->user->id) { 
-            if ($other->email && $other->emailnotifyfav) { 
-                mail_notify_fave($other, $this->user, $notice); 
-            } 
-        } 
-        $this->user->blowFavesCache(); 
+        try {
+            $fave = Fave::addNew($this->user->getProfile(), $notice); 
+        } catch (Exception $e) {
+            $channel->error($this->user, $e->getMessage());
+            return;
+        }
  
         // TRANS: Text shown when a notice has been marked as favourite successfully. 
         $channel->output($this->user, _('Notice marked as fave.'));