]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Poll/showpoll.php
Merge branch 'master' into testing
[quix0rs-gnu-social.git] / plugins / Poll / showpoll.php
index 60669f96ff663c1a7fd7f2f0a0a5b8388291eca6..edfe3fe245f8520105184c231a43ec2e40a2873d 100644 (file)
@@ -48,47 +48,26 @@ class ShowPollAction extends ShownoticeAction
 {
     protected $poll = null;
 
-    /**
-     * For initializing members of the class.
-     *
-     * @param array $argarray misc. arguments
-     *
-     * @return boolean true
-     */
-    function prepare($argarray)
+    function getNotice()
     {
-        OwnerDesignAction::prepare($argarray);
-
         $this->id = $this->trimmed('id');
 
         $this->poll = Poll::staticGet('id', $this->id);
 
         if (empty($this->poll)) {
+            // TRANS: Client exception thrown trying to view a non-existing poll.
             throw new ClientException(_m('No such poll.'), 404);
         }
 
-        $this->notice = $this->poll->getNotice();
+        $notice = $this->poll->getNotice();
 
-        if (empty($this->notice)) {
+        if (empty($notice)) {
             // Did we used to have it, and it got deleted?
+            // TRANS: Client exception thrown trying to view a non-existing poll notice.
             throw new ClientException(_m('No such poll notice.'), 404);
         }
 
-        $this->user = User::staticGet('id', $this->poll->profile_id);
-
-        if (empty($this->user)) {
-            throw new ClientException(_m('No such user.'), 404);
-        }
-
-        $this->profile = $this->user->getProfile();
-
-        if (empty($this->profile)) {
-            throw new ServerException(_m('User without a profile.'));
-        }
-
-        $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
-
-        return true;
+        return $notice;
     }
 
     /**
@@ -100,7 +79,9 @@ class ShowPollAction extends ShownoticeAction
      */
     function title()
     {
-        return sprintf(_m('%s\'s poll: %s'),
+        // TRANS: Page title for a poll.
+        // TRANS: %1$s is the nickname of the user that created the poll, %2$s is the poll question.
+        return sprintf(_m('%1$s\'s poll: %2$s'),
                        $this->user->nickname,
                        $this->poll->question);
     }