OStatus subscription UI tweak: if we're already subscribed/joined, say so and don't offer a 'subscribe'/'join' button on the profile preview page.
This commit is contained in:
parent
e070fcaaae
commit
c79c70ea2c
@ -88,9 +88,13 @@ class OStatusSubAction extends Action
|
|||||||
function showPreviewForm()
|
function showPreviewForm()
|
||||||
{
|
{
|
||||||
if ($this->oprofile->isGroup()) {
|
if ($this->oprofile->isGroup()) {
|
||||||
$this->previewGroup();
|
$ok = $this->previewGroup();
|
||||||
} else {
|
} else {
|
||||||
$this->previewUser();
|
$ok = $this->previewUser();
|
||||||
|
}
|
||||||
|
if (!$ok) {
|
||||||
|
// @fixme maybe provide a cancel button or link back?
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementStart('div', 'entity_actions');
|
$this->elementStart('div', 'entity_actions');
|
||||||
@ -120,12 +124,22 @@ class OStatusSubAction extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a preview for a remote user's profile
|
* Show a preview for a remote user's profile
|
||||||
|
* @return boolean true if we're ok to try subscribing
|
||||||
*/
|
*/
|
||||||
function previewUser()
|
function previewUser()
|
||||||
{
|
{
|
||||||
$oprofile = $this->oprofile;
|
$oprofile = $this->oprofile;
|
||||||
$profile = $oprofile->localProfile();
|
$profile = $oprofile->localProfile();
|
||||||
|
|
||||||
|
$cur = common_current_user();
|
||||||
|
if ($cur->isSubscribed($profile)) {
|
||||||
|
$this->element('div', array('class' => 'error'),
|
||||||
|
_m("You are already subscribed to this user."));
|
||||||
|
$ok = false;
|
||||||
|
} else {
|
||||||
|
$ok = true;
|
||||||
|
}
|
||||||
|
|
||||||
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
||||||
$avatarUrl = $avatar ? $avatar->displayUrl() : false;
|
$avatarUrl = $avatar ? $avatar->displayUrl() : false;
|
||||||
|
|
||||||
@ -133,20 +147,32 @@ class OStatusSubAction extends Action
|
|||||||
$profile->profileurl,
|
$profile->profileurl,
|
||||||
$avatarUrl,
|
$avatarUrl,
|
||||||
$profile->bio);
|
$profile->bio);
|
||||||
|
return $ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a preview for a remote group's profile
|
* Show a preview for a remote group's profile
|
||||||
|
* @return boolean true if we're ok to try joining
|
||||||
*/
|
*/
|
||||||
function previewGroup()
|
function previewGroup()
|
||||||
{
|
{
|
||||||
$oprofile = $this->oprofile;
|
$oprofile = $this->oprofile;
|
||||||
$group = $oprofile->localGroup();
|
$group = $oprofile->localGroup();
|
||||||
|
|
||||||
|
$cur = common_current_user();
|
||||||
|
if ($cur->isMember($group)) {
|
||||||
|
$this->element('div', array('class' => 'error'),
|
||||||
|
_m("You are already a member of this group."));
|
||||||
|
$ok = false;
|
||||||
|
} else {
|
||||||
|
$ok = true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->showEntity($group,
|
$this->showEntity($group,
|
||||||
$group->getProfileUrl(),
|
$group->getProfileUrl(),
|
||||||
$group->homepage_logo,
|
$group->homepage_logo,
|
||||||
$group->description);
|
$group->description);
|
||||||
|
return $ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user