]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Favorite/actions/favor.php
Fave::addNew now calls Notice::saveActivity
[quix0rs-gnu-social.git] / plugins / Favorite / actions / favor.php
index 37668c989cf017caa39382449f4510f11e88e5a8..d1c9df34f5ff590e35a3245d608d6dc136a48fba 100644 (file)
@@ -74,14 +74,8 @@ class FavorAction extends FormAction
             throw new AlreadyFulfilledException(_('You have already favorited this!'));
         }
 
-        $fave = Fave::addNew($this->scoped, $this->target);
-
-        if (empty($fave)) {
-            $this->serverError(_('Could not create favorite.'));
-        }
-
-        $this->notify($fave, $this->target, $this->scoped);
-        Fave::blowCacheForProfileId($this->scoped->id);
+        // throws exception on failure
+        $stored = Fave::addNew($this->scoped, $this->target);
 
         return _('Favorited the notice');
     }
@@ -93,25 +87,4 @@ class FavorAction extends FormAction
             $disfavor->show();
         }
     }
-
-    /**
-     * Notify the author of the favorite that the user likes their notice
-     *
-     * @param Favorite $fave   the favorite in question
-     * @param Notice   $notice the notice that's been faved
-     * @param User     $user   the user doing the favoriting
-     *
-     * @return void
-     */
-    function notify($fave, $notice, $user)
-    {
-        $other = User::getKV('id', $notice->profile_id);
-        if ($other && $other->id != $user->id && !empty($other->email)) {
-            require_once INSTALLDIR.'/lib/mail.php';
-
-            mail_notify_fave($other, $user->getProfile(), $notice);
-            // XXX: notify by IM
-            // XXX: notify by SMS
-        }
-    }    
 }