]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Favorite/FavoritePlugin.php
neo-quitter unuglification by marcus, merge-request 44
[quix0rs-gnu-social.git] / plugins / Favorite / FavoritePlugin.php
index dabc6c5e81365c3539602d5c4e01ffcff3d9451b..810957c322fbb499f30ce6a2a386f1ee6aa6b821 100644 (file)
@@ -49,6 +49,11 @@ class FavoritePlugin extends ActivityHandlerPlugin
         return true;
     }
 
+    public function initialize()
+    {
+        common_config_set('email', 'notify_fave', $this->email_notify_fave);
+    }
+
     public function onStartUpgrade()
     {
         // This is a migration feature that will make sure we move
@@ -338,7 +343,6 @@ class FavoritePlugin extends ActivityHandlerPlugin
 
     public function onAppendUserActivityStreamObjects(UserActivityStream $uas, array &$objs)
     {
-        $faves = array();
         $fave = new Fave();
         $fave->user_id = $uas->getUser()->id;
 
@@ -348,11 +352,11 @@ class FavoritePlugin extends ActivityHandlerPlugin
 
         if ($fave->find()) {
             while ($fave->fetch()) {
-                $faves[] = clone($fave);
+                $objs[] = clone($fave);
             }
         }
 
-        return $faves;
+        return true;
     }
 
     public function onStartShowThreadedNoticeTailItems(NoticeListItem $nli, Notice $notice, &$threadActive)
@@ -432,9 +436,7 @@ class FavoritePlugin extends ActivityHandlerPlugin
 
     public function onEndEmailFormData(Action $action, Profile $scoped)
     {
-        // getConfigData will fall back on systemwide default
-        // and we only wish to save numerical true or false.
-        $emailfave = $scoped->getPref('email', 'notify_fave', $this->email_notify_fave) ? 1 : 0;
+        $emailfave = $scoped->getConfigPref('email', 'notify_fave') ? 1 : 0;
 
         $action->elementStart('li');
         $action->checkbox('email-notify_fave',
@@ -525,7 +527,7 @@ class FavoritePlugin extends ActivityHandlerPlugin
  */
 function mail_notify_fave(User $rcpt, Profile $sender, Notice $notice)
 {
-    if (!$rcpt->receivesEmailNotifications() || !$rcpt->getPref('email', 'notify_fave', $this->email_notify_fave)) {
+    if (!$rcpt->receivesEmailNotifications() || !$rcpt->getConfigPref('email', 'notify_fave')) {
         return;
     }