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...
This commit is contained in:
Mikael Nordfeldth 2013-09-09 20:45:20 +02:00
parent b2a0aa20bf
commit c5bf6cb05e
2 changed files with 8 additions and 8 deletions

View 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: Client error displayed trying to send a direct message to a user while sender and
// TRANS: receiver are not subscribed to each other. // TRANS: receiver are not subscribed to each other.
$this->clientError(_('You cannot send a message to this user.'), 404); $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. // TRANS: Client error displayed trying to send a direct message to self.
$this->clientError(_('Do not send a message to yourself; ' . $this->clientError(_('Do not send a message to yourself; ' .
'just say it to yourself quietly instead.'), 403); '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(); $message->notify();
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
@ -157,7 +157,7 @@ class NewmessageAction extends FormAction
$this->elementEnd('html'); $this->elementEnd('html');
} else { } else {
$url = common_local_url('outbox', $url = common_local_url('outbox',
array('nickname' => $user->nickname)); array('nickname' => $this->scoped->nickname));
common_redirect($url, 303); common_redirect($url, 303);
} }
} }

View File

@ -145,19 +145,19 @@ class NewnoticeAction extends FormAction
$this->trimmed('lon'), $this->trimmed('lon'),
$this->trimmed('location_id'), $this->trimmed('location_id'),
$this->trimmed('location_ns'), $this->trimmed('location_ns'),
$user->getProfile()); $this->scoped);
} else { } else {
$locOptions = Notice::locationOptions(null, $locOptions = Notice::locationOptions(null,
null, null,
null, null,
null, null,
$user->getProfile()); $this->scoped);
} }
$options = array_merge($options, $locOptions); $options = array_merge($options, $locOptions);
} }
$author_id = $user->id; $author_id = $this->scoped->id;
$text = $content_shortened; $text = $content_shortened;
// Does the heavy-lifting for getting "To:" information // 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))) { 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)) { if (isset($upload)) {
$upload->attachToNotice($notice); $upload->attachToNotice($notice);
@ -194,7 +194,7 @@ class NewnoticeAction extends FormAction
if ($returnto) { if ($returnto) {
$url = common_local_url($returnto, $url = common_local_url($returnto,
array('nickname' => $user->nickname)); array('nickname' => $this->scoped->nickname));
} else { } else {
$url = common_local_url('shownotice', $url = common_local_url('shownotice',
array('notice' => $notice->id)); array('notice' => $notice->id));