]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showmessage.php
try to make replies point to the clicked-on notice
[quix0rs-gnu-social.git] / actions / showmessage.php
index c57c96aefdfc8ee178ff14507b8c77157c23c309..c171ffe0b596b790bd5b458dbcae1a0393ed9026 100644 (file)
@@ -27,9 +27,7 @@ class ShowmessageAction extends MailboxAction {
 
                Action::handle($args);
 
-               $id = $this->trimmed('id');
-
-               $message = Message::staticGet('id', $id);
+               $message = $this->get_message();
 
                if (!$message) {
                        $this->client_error(_('No such message.'), 404);
@@ -38,19 +36,16 @@ class ShowmessageAction extends MailboxAction {
                
                $cur = common_current_user();
                
-               if (!$cur ||
-                       $cur->id != $message->from_profile &&
-                       $cur->id != $message->to_profile) 
-               {
-                       $this->client_error(_('Only the sender and recipient may read this message.'), 404);
+               if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
+                       $this->show_page($cur, 1);
+               } else {
+                       $this->client_error(_('Only the sender and recipient may read this message.'), 403);
                        return;
                }
-                       
-               $this->show_page($cur, 1);
        }
        
        function get_message() {
-               $id = $this->trimmed('id');
+               $id = $this->trimmed('message');
                $message = Message::staticGet('id', $id);
                return $message;
        }
@@ -63,20 +58,23 @@ class ShowmessageAction extends MailboxAction {
                
                if ($user->id == $message->from_profile) {
                        $to = $message->getTo();
-                       $title = sprintf(_('Message to %1\$s on %2\$s'),
+                       $title = sprintf(_("Message to %1\$s on %2\$s"),
                                                         $to->nickname,
                                                         common_exact_date($message->created));
                } else if ($user->id == $message->to_profile) {
                        $from = $message->getFrom();
-                       $title = sprintf(_('Message from %1\$s on %2\$s'),
+                       $title = sprintf(_("Message from %1\$s on %2\$s"),
                                                         $from->nickname,
                                                         common_exact_date($message->created));
                }
                return $title;
        }
-       
+
        function get_messages($user, $page) {
-               return $this->get_message();
+               $message = new Message();
+               $message->id = $this->trimmed('message');
+               $message->find();
+               return $message;
        }
        
        function get_message_profile($message) {
@@ -94,5 +92,9 @@ class ShowmessageAction extends MailboxAction {
        function get_instructions() {
                return '';
        }
+       
+       function views_menu() {
+               return;
+       }
 }
        
\ No newline at end of file