]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Using a bit more of $this->scoped (Action parent class)
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 9 Sep 2013 18:45:20 +0000 (20:45 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 9 Sep 2013 18:45:20 +0000 (20:45 +0200)
$this->scoped is the currently active profile, which is intended
to replace the $user object in the long run...

actions/newmessage.php
actions/newnotice.php

index 5d097188fc0b3af822186dbc8afd92fc4704f547..b1b1c1db062ef574193a3995f4c77adfbf61d693 100644 (file)
@@ -132,13 +132,13 @@ class NewmessageAction extends FormAction
             // TRANS: Client error displayed trying to send a direct message to a user while sender and
             // TRANS: receiver are not subscribed to each other.
             $this->clientError(_('You cannot send a message to this user.'), 404);
-        } else if ($user->id == $this->other->id) {
+        } else if ($this->scoped->id == $this->other->id) {
             // TRANS: Client error displayed trying to send a direct message to self.
             $this->clientError(_('Do not send a message to yourself; ' .
                 'just say it to yourself quietly instead.'), 403);
         }
 
-        $message = Message::saveNew($user->id, $this->other->id, $this->content, 'web');
+        $message = Message::saveNew($this->scoped->id, $this->other->id, $this->content, 'web');
         $message->notify();
 
         if ($this->boolean('ajax')) {
@@ -157,7 +157,7 @@ class NewmessageAction extends FormAction
             $this->elementEnd('html');
         } else {
             $url = common_local_url('outbox',
-                array('nickname' => $user->nickname));
+                array('nickname' => $this->scoped->nickname));
             common_redirect($url, 303);
         }
     }
index 7e2de90cf8b81d654ec2b1a52ba142848322d451..9ac8d46b6e7fbac8ec62bbbc8290b3ee717a122d 100644 (file)
@@ -145,19 +145,19 @@ class NewnoticeAction extends FormAction
                                                       $this->trimmed('lon'),
                                                       $this->trimmed('location_id'),
                                                       $this->trimmed('location_ns'),
-                                                      $user->getProfile());
+                                                      $this->scoped);
             } else {
                 $locOptions = Notice::locationOptions(null,
                                                       null,
                                                       null,
                                                       null,
-                                                      $user->getProfile());
+                                                      $this->scoped);
             }
 
             $options = array_merge($options, $locOptions);
         }
 
-        $author_id = $user->id;
+        $author_id = $this->scoped->id;
         $text      = $content_shortened;
 
         // Does the heavy-lifting for getting "To:" information
@@ -166,7 +166,7 @@ class NewnoticeAction extends FormAction
 
         if (Event::handle('StartNoticeSaveWeb', array($this, &$author_id, &$text, &$options))) {
 
-            $notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
+            $notice = Notice::saveNew($this->scoped->id, $content_shortened, 'web', $options);
 
             if (isset($upload)) {
                 $upload->attachToNotice($notice);
@@ -194,7 +194,7 @@ class NewnoticeAction extends FormAction
 
             if ($returnto) {
                 $url = common_local_url($returnto,
-                                        array('nickname' => $user->nickname));
+                                        array('nickname' => $this->scoped->nickname));
             } else {
                 $url = common_local_url('shownotice',
                                         array('notice' => $notice->id));