Rationalize logic in showProfile()
Pulled together some of the if() statements in showProfile() so they weren't so redundant. Also, reformatted the file. Lots of whitespace gar.
This commit is contained in:
parent
8ade2e1c7d
commit
5702764e52
|
@ -250,6 +250,7 @@ class ShowstreamAction extends ProfileAction
|
|||
}
|
||||
|
||||
$tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
|
||||
|
||||
if (count($tags) > 0) {
|
||||
$this->elementStart('dl', 'entity_tags');
|
||||
$this->element('dt', null, _('Tags'));
|
||||
|
@ -268,23 +269,30 @@ class ShowstreamAction extends ProfileAction
|
|||
$this->elementEnd('dd');
|
||||
$this->elementEnd('dl');
|
||||
}
|
||||
|
||||
$this->elementEnd('div');
|
||||
|
||||
$this->elementStart('div', 'entity_actions');
|
||||
$this->element('h2', null, _('User actions'));
|
||||
$this->elementStart('ul');
|
||||
|
||||
if ($cur && $cur->id == $this->profile->id) {
|
||||
if (empty($cur)) { // not logged in
|
||||
$this->elementStart('li', 'entity_subscribe');
|
||||
$this->showRemoteSubscribeLink();
|
||||
$this->elementEnd('li');
|
||||
} else {
|
||||
if ($cur->id == $this->profile->id) { // your own page
|
||||
$this->elementStart('li', 'entity_edit');
|
||||
$this->element('a', array('href' => common_local_url('profilesettings'),
|
||||
'title' => _('Edit profile settings')),
|
||||
_('Edit'));
|
||||
$this->elementEnd('li');
|
||||
}
|
||||
} else { // someone else's page
|
||||
|
||||
// subscribe/unsubscribe button
|
||||
|
||||
if ($cur) {
|
||||
if ($cur->id != $this->profile->id) {
|
||||
$this->elementStart('li', 'entity_subscribe');
|
||||
|
||||
if ($cur->isSubscribed($this->profile)) {
|
||||
$usf = new UnsubscribeForm($this, $this->profile);
|
||||
$usf->show();
|
||||
|
@ -293,20 +301,19 @@ class ShowstreamAction extends ProfileAction
|
|||
$sf->show();
|
||||
}
|
||||
$this->elementEnd('li');
|
||||
}
|
||||
} else {
|
||||
$this->elementStart('li', 'entity_subscribe');
|
||||
$this->showRemoteSubscribeLink();
|
||||
$this->elementEnd('li');
|
||||
}
|
||||
|
||||
if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
|
||||
if ($cur->mutuallySubscribed($user)) {
|
||||
|
||||
// message
|
||||
|
||||
$this->elementStart('li', 'entity_send-a-message');
|
||||
$this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)),
|
||||
'title' => _('Send a direct message to this user')),
|
||||
_('Message'));
|
||||
$this->elementEnd('li');
|
||||
|
||||
// nudge
|
||||
|
||||
if ($user->email && $user->emailnotifynudge) {
|
||||
$this->elementStart('li', 'entity_nudge');
|
||||
$nf = new NudgeForm($this, $user);
|
||||
|
@ -315,7 +322,8 @@ class ShowstreamAction extends ProfileAction
|
|||
}
|
||||
}
|
||||
|
||||
if ($cur && $cur->id != $this->profile->id) {
|
||||
// block/unblock
|
||||
|
||||
$blocked = $cur->hasBlocked($this->profile);
|
||||
$this->elementStart('li', 'entity_block');
|
||||
if ($blocked) {
|
||||
|
@ -331,6 +339,8 @@ class ShowstreamAction extends ProfileAction
|
|||
}
|
||||
$this->elementEnd('li');
|
||||
}
|
||||
}
|
||||
|
||||
$this->elementEnd('ul');
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user