]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/atomnoticefeed.php
Merge branch 'master' of https://git.gnu.io/gnu/gnu-social into social-master
[quix0rs-gnu-social.git] / lib / atomnoticefeed.php
index 6ed803ce4ebb35a0350f669b26fc098b896a3585..292bc97e8584ccfe0819bb93522d175051a5451d 100644 (file)
@@ -45,6 +45,7 @@ if (!defined('STATUSNET'))
 class AtomNoticeFeed extends Atom10Feed
 {
     var $cur;
+    protected $scoped=null;
 
     /**
      * Constructor - adds a bunch of XML namespaces we need in our
@@ -58,7 +59,8 @@ class AtomNoticeFeed extends Atom10Feed
     function __construct($cur = null, $indent = true) {
         parent::__construct($indent);
 
-        $this->cur = $cur;
+        $this->cur = $cur ?: common_current_user();
+        $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
 
         // Feeds containing notice info use these namespaces
 
@@ -125,12 +127,15 @@ class AtomNoticeFeed extends Atom10Feed
      */
     function addEntryFromNotice($notice)
     {
-        $source = $this->showSource();
-        $author = $this->showAuthor();
-
-        $cur = empty($this->cur) ? common_current_user() : $this->cur;
-
-        $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
+        try {
+            $source = $this->showSource();
+            $author = $this->showAuthor();
+
+            $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $this->scoped));
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            // we continue on exceptions
+        }
     }
 
     function showSource()