Separate the UI paths for ostatussub and ostatusgroup. They'll redirect to each other transparently if they find you've put a remote entity of the other type.

This commit is contained in:
Brion Vibber
2010-03-03 13:40:26 -08:00
parent c04c8ae59a
commit a42d1116db
3 changed files with 224 additions and 103 deletions

View File

@@ -51,8 +51,8 @@ class OStatusPlugin extends Plugin
array('action' => 'ostatusinit'), array('nickname' => '[A-Za-z0-9_-]+'));
$m->connect('main/ostatussub',
array('action' => 'ostatussub'));
$m->connect('main/ostatussub',
array('action' => 'ostatussub'), array('feed' => '[A-Za-z0-9\.\/\:]+'));
$m->connect('main/ostatusgroup',
array('action' => 'ostatusgroup'));
// PuSH actions
$m->connect('main/push/hub', array('action' => 'pushhub'));
@@ -731,7 +731,7 @@ class OStatusPlugin extends Plugin
function onStartShowUserGroupsContent($action)
{
$this->showEntityRemoteSubscribe($action);
$this->showEntityRemoteSubscribe($action, 'ostatusgroup');
return true;
}
@@ -745,19 +745,19 @@ class OStatusPlugin extends Plugin
function onEndShowGroupsMiniList($action)
{
$this->showEntityRemoteSubscribe($action);
$this->showEntityRemoteSubscribe($action, 'ostatusgroup');
return true;
}
function showEntityRemoteSubscribe($action)
function showEntityRemoteSubscribe($action, $target='ostatussub')
{
$user = common_current_user();
if ($user && ($user->id == $action->profile->id)) {
$action->elementStart('div', 'entity_actions');
$action->elementStart('p', array('id' => 'entity_remote_subscribe',
'class' => 'entity_subscribe'));
$action->element('a', array('href' => common_local_url('ostatussub'),
$action->element('a', array('href' => common_local_url($target),
'class' => 'entity_remote_subscribe')
, _m('Remote'));
$action->elementEnd('p');