From c5bf6cb05e1d0a5b6fd9b7988362396e6f8ec2be Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 9 Sep 2013 20:45:20 +0200 Subject: [PATCH] Using a bit more of $this->scoped (Action parent class) $this->scoped is the currently active profile, which is intended to replace the $user object in the long run... --- actions/newmessage.php | 6 +++--- actions/newnotice.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/actions/newmessage.php b/actions/newmessage.php index 5d097188fc..b1b1c1db06 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -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); } } diff --git a/actions/newnotice.php b/actions/newnotice.php index 7e2de90cf8..9ac8d46b6e 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -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));