]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/all.php
isReadOnly() now takes arguments
[quix0rs-gnu-social.git] / actions / all.php
index 9a163267049559d6c8229010580eec98634445fd..69890a70ca351bd2ce54978d5e6dda076dbbe262 100644 (file)
@@ -23,31 +23,13 @@ require_once INSTALLDIR.'/lib/personalgroupnav.php';
 require_once INSTALLDIR.'/lib/noticelist.php';
 require_once INSTALLDIR.'/lib/feedlist.php';
 
-class AllAction extends Action
+class AllAction extends ProfileAction
 {
-    var $user = null;
-    var $page = null;
-
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
 
-    function prepare($args)
-    {
-        parent::prepare($args);
-        $nickname = common_canonical_nickname($this->arg('nickname'));
-        $this->user = User::staticGet('nickname', $nickname);
-        $this->page = $this->trimmed('page');
-        if (!$this->page) {
-            $this->page = 1;
-        }
-
-        common_set_returnto($this->selfUrl());
-
-        return true;
-    }
-
     function handle($args)
     {
         parent::handle($args);
@@ -93,13 +75,8 @@ class AllAction extends Action
         $nav->show();
     }
 
-    function showPageNotice()
+    function showEmptyListMessage()
     {
-        $notice = $this->user->noticesWithFriends(0, 1);
-        if ($notice->count()) {
-            return;
-        }
-
         $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
 
         if (common_logged_in()) {
@@ -107,7 +84,7 @@ class AllAction extends Action
             if ($this->user->id === $current_user->id) {
                 $message .= _('Try subscribing to more people, [join a group](%%action.groups) or post something yourself.');
             } else {
-                $message .= sprintf(_('You can try to [nudge %s](./) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, '@' . $this->user->nickname);
+                $message .= sprintf(_('You can try to [nudge %s](../%s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
             }
         }
         else {
@@ -127,6 +104,10 @@ class AllAction extends Action
 
         $cnt = $nl->show();
 
+        if (0 == $cnt) {
+            $this->showEmptyListMessage();
+        }
+
         $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
                           $this->page, 'all', array('nickname' => $this->user->nickname));
     }