]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make gateway notices available to the auth user in the API
authorZach Copley <zach@controlyourself.ca>
Tue, 23 Jun 2009 22:53:49 +0000 (15:53 -0700)
committerZach Copley <zach@controlyourself.ca>
Tue, 23 Jun 2009 22:53:49 +0000 (15:53 -0700)
actions/twitapifavorites.php
actions/twitapistatuses.php

index e40fea91afa7997e1d952e1d28e77b1c32c44c50..8256668f3d22a0622de9e3708c64173d4eab4ad1 100644 (file)
@@ -61,7 +61,11 @@ class TwitapifavoritesAction extends TwitterapiAction
         $since_id = (int)$this->arg('since_id', 0);
         $since    = $this->arg('since');
 
-        $notice = $user->favoriteNotices(($page-1)*$count, $count);
+        if (!empty($this->auth_user) && $this->auth_user->id == $user->id) {
+            $notice = $user->favoriteNotices(($page-1)*$count, $count, true);
+        } else {
+            $notice = $user->favoriteNotices(($page-1)*$count, $count, false);
+        }
 
         switch($apidata['content-type']) {
         case 'xml':
index 2bc404063846d58f15fdc63b845837aba97b5a1e..e1fbc5c767f4fc20658734e3dabf1d75de945493 100644 (file)
@@ -75,8 +75,10 @@ class TwitapistatusesAction extends TwitterapiAction
     {
         parent::handle($args);
 
+        $this->auth_user = $apidata['user'];
         $user = $this->get_user($apidata['api_arg'], $apidata);
-        $this->auth_user = $user;
+
+        common_debug("auth user = " . $this->auth_user->nickname);
 
         if (empty($user)) {
              $this->clientError(_('No such user!'), 404,
@@ -100,8 +102,13 @@ class TwitapistatusesAction extends TwitterapiAction
         $since_id = (int)$this->arg('since_id', 0);
         $since    = $this->arg('since');
 
-        $notice = $user->noticesWithFriends(($page-1)*$count,
-            $count, $since_id, $max_id,$since);
+        if (!empty($this->auth_user) && $this->auth_user->id == $user->id) {
+            $notice = $user->noticeInbox(($page-1)*$count,
+                $count, $since_id, $max_id, $since);
+        } else {
+            $notice = $user->noticesWithFriends(($page-1)*$count,
+                $count, $since_id, $max_id, $since);
+        }
 
         switch($apidata['content-type']) {
         case 'xml':