some minor fixes for new messages

darcs-hash:20080917192121-5ed1f-15603b7f7d5246caed3e1633cc3361e1288d8653.gz
This commit is contained in:
Evan Prodromou 2008-09-17 15:21:21 -04:00
parent a4cca01451
commit 671282fcd5

View File

@ -59,6 +59,9 @@ class NewmessageAction extends Action {
} else if (!$user->mutuallySubscribed($other)) { } else if (!$user->mutuallySubscribed($other)) {
$this->client_error(_('You can\'t send a message to this user.'), 404); $this->client_error(_('You can\'t send a message to this user.'), 404);
return; return;
} else if ($user->id == $other->id) {
$this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
return;
} }
$message = Message::saveNew($user->id, $other->id, $content, 'web'); $message = Message::saveNew($user->id, $other->id, $content, 'web');
@ -93,8 +96,10 @@ class NewmessageAction extends Action {
$mutual = array(); $mutual = array();
while ($mutual_users->fetch()) { while ($mutual_users->fetch()) {
if ($mutual_users->id != $user->id) {
$mutual[$mutual_users->id] = $mutual_users->nickname; $mutual[$mutual_users->id] = $mutual_users->nickname;
} }
}
$mutual_users->free(); $mutual_users->free();
unset($mutual_users); unset($mutual_users);
@ -138,7 +143,7 @@ class NewmessageAction extends Action {
} }
common_show_header(_('New message'), NULL, common_show_header(_('New message'), NULL,
array($content, $user, $to), array($content, $user, $other),
array($this, 'show_top')); array($this, 'show_top'));
if ($msg) { if ($msg) {