notice should show user design

This commit is contained in:
Evan Prodromou 2009-07-02 08:21:54 -04:00
parent b4de1d4636
commit aea546c122

View File

@ -45,7 +45,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
* @link http://laconi.ca/ * @link http://laconi.ca/
*/ */
class ShownoticeAction extends Action class ShownoticeAction extends OwnerDesignAction
{ {
/** /**
* Notice object to show * Notice object to show
@ -83,18 +83,25 @@ class ShownoticeAction extends Action
$this->notice = Notice::staticGet($id); $this->notice = Notice::staticGet($id);
if (!$this->notice) { if (empty($this->notice)) {
$this->clientError(_('No such notice.'), 404); $this->clientError(_('No such notice.'), 404);
return false; return false;
} }
$this->profile = $this->notice->getProfile(); $this->profile = $this->notice->getProfile();
if (!$this->profile) { if (empty($this->profile)) {
$this->serverError(_('Notice has no profile'), 500); $this->serverError(_('Notice has no profile'), 500);
return false; return false;
} }
$this->user = User::staticGet('id', $this->profile->id);
if (empty($this->user)) {
$this->serverError(_('Not a local notice'), 500);
return false;
}
$this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
return true; return true;
@ -158,8 +165,14 @@ class ShownoticeAction extends Action
function title() function title()
{ {
if (!empty($this->profile->fullname)) {
$base = $this->profile->fullname . ' (' . $this->user->nickname . ') ';
} else {
$base = $this->user->nickname;
}
return sprintf(_('%1$s\'s status on %2$s'), return sprintf(_('%1$s\'s status on %2$s'),
$this->profile->nickname, $base,
common_exact_date($this->notice->created)); common_exact_date($this->notice->created));
} }