don't allow forwarding your own notice

This commit is contained in:
Evan Prodromou 2009-12-08 17:52:20 -05:00
parent 985d6a0de4
commit 21757186e9
2 changed files with 6 additions and 1 deletions

View File

@ -72,6 +72,11 @@ class ForwardAction extends Action
return false; return false;
} }
if ($this->user->id == $this->notice->profile_id) {
$this->clientError(_("You can't forward your own notice."));
return false;
}
$token = $this->trimmed('token-'.$id); $token = $this->trimmed('token-'.$id);
if (empty($token) || $token != common_session_token()) { if (empty($token) || $token != common_session_token()) {

View File

@ -540,7 +540,7 @@ class NoticeListItem extends Widget
function showForwardForm() function showForwardForm()
{ {
$user = common_current_user(); $user = common_current_user();
if ($user) { if ($user && $user->id != $this->notice->profile_id) {
$profile = $user->getProfile(); $profile = $user->getProfile();
if ($profile->hasForwarded($this->notice->id)) { if ($profile->hasForwarded($this->notice->id)) {
$this->out->text(_('Forwarded')); $this->out->text(_('Forwarded'));