]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Merge branch 'activityhooks' into 0.9.x
[quix0rs-gnu-social.git] / classes / Profile.php
index 3b1e54c4d2b4c3d2086aa7b8ff80dbc042700859..0d0463b730564179e7f890921fa3da24844394db 100644 (file)
@@ -152,17 +152,16 @@ class Profile extends Memcached_DataObject
      *
      * @return mixed Notice or null
      */
+
     function getCurrentNotice()
     {
-        $notice = new Notice();
-        $notice->profile_id = $this->id;
-        // @fixme change this to sort on notice.id only when indexes are updated
-        $notice->orderBy('created DESC, notice.id DESC');
-        $notice->limit(1);
-        if ($notice->find(true)) {
+        $notice = $this->getNotices(0, 1);
+
+        if ($notice->fetch()) {
             return $notice;
+        } else {
+            return null;
         }
-        return null;
     }
 
     function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0)
@@ -947,4 +946,20 @@ class Profile extends Memcached_DataObject
 
         return $result;
     }
+
+    function getAtomFeed()
+    {
+        $feed = null;
+
+        if (Event::handle('StartProfileGetAtomFeed', array($this, &$feed))) {
+            $user = User::staticGet('id', $this->id);
+            if (!empty($user)) {
+                $feed = common_local_url('ApiTimelineUser', array('id' => $user->id,
+                                                                  'format' => 'atom'));
+            }
+            Event::handle('EndProfileGetAtomFeed', array($this, $feed));
+        }
+
+        return $feed;
+    }
 }