Merge branch 'testing' of git@gitorious.org:statusnet/mainline
This commit is contained in:
commit
13521cb510
|
@ -790,6 +790,12 @@ StartShowSubscriptionsMiniList: at the start of subscriptions mini list
|
||||||
EndShowSubscriptionsMiniList: at the end of subscriptions mini list
|
EndShowSubscriptionsMiniList: at the end of subscriptions mini list
|
||||||
- $action: the current action
|
- $action: the current action
|
||||||
|
|
||||||
|
StartShowGroupsMiniList: at the start of groups mini list
|
||||||
|
- $action: the current action
|
||||||
|
|
||||||
|
EndShowGroupsMiniList: at the end of groups mini list
|
||||||
|
- $action: the current action
|
||||||
|
|
||||||
StartDeleteUserForm: starting the data in the form for deleting a user
|
StartDeleteUserForm: starting the data in the form for deleting a user
|
||||||
- $action: action being shown
|
- $action: action being shown
|
||||||
- $user: user being deleted
|
- $user: user being deleted
|
||||||
|
|
|
@ -877,7 +877,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
foreach (array_unique($match[1]) as $nickname) {
|
foreach (array_unique($match[1]) as $nickname) {
|
||||||
/* XXX: remote groups. */
|
/* XXX: remote groups. */
|
||||||
$group = User_group::getForNickname($nickname);
|
$group = User_group::getForNickname($nickname, $profile);
|
||||||
|
|
||||||
if (empty($group)) {
|
if (empty($group)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -282,6 +282,32 @@ class Profile extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGroups($offset=0, $limit=null)
|
||||||
|
{
|
||||||
|
$qry =
|
||||||
|
'SELECT user_group.* ' .
|
||||||
|
'FROM user_group JOIN group_member '.
|
||||||
|
'ON user_group.id = group_member.group_id ' .
|
||||||
|
'WHERE group_member.profile_id = %d ' .
|
||||||
|
'ORDER BY group_member.created DESC ';
|
||||||
|
|
||||||
|
if ($offset>0 && !is_null($limit)) {
|
||||||
|
if ($offset) {
|
||||||
|
if (common_config('db','type') == 'pgsql') {
|
||||||
|
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
||||||
|
} else {
|
||||||
|
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$groups = new User_group();
|
||||||
|
|
||||||
|
$cnt = $groups->query(sprintf($qry, $this->id));
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
|
|
||||||
function avatarUrl($size=AVATAR_PROFILE_SIZE)
|
function avatarUrl($size=AVATAR_PROFILE_SIZE)
|
||||||
{
|
{
|
||||||
$avatar = $this->getAvatar($size);
|
$avatar = $this->getAvatar($size);
|
||||||
|
|
|
@ -612,28 +612,8 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
function getGroups($offset=0, $limit=null)
|
function getGroups($offset=0, $limit=null)
|
||||||
{
|
{
|
||||||
$qry =
|
$profile = $this->getProfile();
|
||||||
'SELECT user_group.* ' .
|
return $profile->getGroups($offset, $limit);
|
||||||
'FROM user_group JOIN group_member '.
|
|
||||||
'ON user_group.id = group_member.group_id ' .
|
|
||||||
'WHERE group_member.profile_id = %d ' .
|
|
||||||
'ORDER BY group_member.created DESC ';
|
|
||||||
|
|
||||||
if ($offset>0 && !is_null($limit)) {
|
|
||||||
if ($offset) {
|
|
||||||
if (common_config('db','type') == 'pgsql') {
|
|
||||||
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
|
||||||
} else {
|
|
||||||
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups = new User_group();
|
|
||||||
|
|
||||||
$cnt = $groups->query(sprintf($qry, $this->id));
|
|
||||||
|
|
||||||
return $groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSubscriptions($offset=0, $limit=null)
|
function getSubscriptions($offset=0, $limit=null)
|
||||||
|
|
|
@ -279,12 +279,26 @@ class User_group extends Memcached_DataObject
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getForNickname($nickname)
|
static function getForNickname($nickname, $profile=null)
|
||||||
{
|
{
|
||||||
$nickname = common_canonical_nickname($nickname);
|
$nickname = common_canonical_nickname($nickname);
|
||||||
$group = User_group::staticGet('nickname', $nickname);
|
|
||||||
|
// Are there any matching remote groups this profile's in?
|
||||||
|
if ($profile) {
|
||||||
|
$group = $profile->getGroups();
|
||||||
|
while ($group->fetch()) {
|
||||||
|
if ($group->nickname == $nickname) {
|
||||||
|
// @fixme is this the best way?
|
||||||
|
return clone($group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not, check local groups.
|
||||||
|
|
||||||
|
$group = Local_group::staticGet('nickname', $nickname);
|
||||||
if (!empty($group)) {
|
if (!empty($group)) {
|
||||||
return $group;
|
return User_group::staticGet('id', $group->group_id);
|
||||||
}
|
}
|
||||||
$alias = Group_alias::staticGet('alias', $nickname);
|
$alias = Group_alias::staticGet('alias', $nickname);
|
||||||
if (!empty($alias)) {
|
if (!empty($alias)) {
|
||||||
|
|
|
@ -420,13 +420,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
function showPrimaryNav()
|
function showPrimaryNav()
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
$connect = '';
|
|
||||||
if (common_config('xmpp', 'enabled')) {
|
|
||||||
$connect = 'imsettings';
|
|
||||||
} else if (common_config('sms', 'enabled')) {
|
|
||||||
$connect = 'smssettings';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->elementStart('dl', array('id' => 'site_nav_global_primary'));
|
$this->elementStart('dl', array('id' => 'site_nav_global_primary'));
|
||||||
$this->element('dt', null, _('Primary site navigation'));
|
$this->element('dt', null, _('Primary site navigation'));
|
||||||
$this->elementStart('dd');
|
$this->elementStart('dd');
|
||||||
|
@ -437,10 +430,8 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
_('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
|
_('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
|
||||||
$this->menuItem(common_local_url('profilesettings'),
|
$this->menuItem(common_local_url('profilesettings'),
|
||||||
_('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
|
_('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
|
||||||
if ($connect) {
|
$this->menuItem(common_local_url('oauthconnectionssettings'),
|
||||||
$this->menuItem(common_local_url($connect),
|
_('Connect'), _('Connect to services'), false, 'nav_connect');
|
||||||
_('Connect'), _('Connect to services'), false, 'nav_connect');
|
|
||||||
}
|
|
||||||
if ($user->hasRight(Right::CONFIGURESITE)) {
|
if ($user->hasRight(Right::CONFIGURESITE)) {
|
||||||
$this->menuItem(common_local_url('siteadminpanel'),
|
$this->menuItem(common_local_url('siteadminpanel'),
|
||||||
_('Admin'), _('Change site configuration'), false, 'nav_admin');
|
_('Admin'), _('Change site configuration'), false, 'nav_admin');
|
||||||
|
|
|
@ -105,7 +105,6 @@ class ProfileAction extends OwnerDesignAction
|
||||||
|
|
||||||
$this->elementStart('div', array('id' => 'entity_subscriptions',
|
$this->elementStart('div', array('id' => 'entity_subscriptions',
|
||||||
'class' => 'section'));
|
'class' => 'section'));
|
||||||
|
|
||||||
if (Event::handle('StartShowSubscriptionsMiniList', array($this))) {
|
if (Event::handle('StartShowSubscriptionsMiniList', array($this))) {
|
||||||
$this->element('h2', null, _('Subscriptions'));
|
$this->element('h2', null, _('Subscriptions'));
|
||||||
|
|
||||||
|
@ -229,27 +228,29 @@ class ProfileAction extends OwnerDesignAction
|
||||||
|
|
||||||
$this->elementStart('div', array('id' => 'entity_groups',
|
$this->elementStart('div', array('id' => 'entity_groups',
|
||||||
'class' => 'section'));
|
'class' => 'section'));
|
||||||
|
if (Event::handle('StartShowGroupsMiniList', array($this))) {
|
||||||
|
$this->element('h2', null, _('Groups'));
|
||||||
|
|
||||||
$this->element('h2', null, _('Groups'));
|
if ($groups) {
|
||||||
|
$gml = new GroupMiniList($groups, $this->user, $this);
|
||||||
if ($groups) {
|
$cnt = $gml->show();
|
||||||
$gml = new GroupMiniList($groups, $this->user, $this);
|
if ($cnt == 0) {
|
||||||
$cnt = $gml->show();
|
$this->element('p', null, _('(None)'));
|
||||||
if ($cnt == 0) {
|
}
|
||||||
$this->element('p', null, _('(None)'));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($cnt > GROUPS_PER_MINILIST) {
|
if ($cnt > GROUPS_PER_MINILIST) {
|
||||||
$this->elementStart('p');
|
$this->elementStart('p');
|
||||||
$this->element('a', array('href' => common_local_url('usergroups',
|
$this->element('a', array('href' => common_local_url('usergroups',
|
||||||
array('nickname' => $this->profile->nickname)),
|
array('nickname' => $this->profile->nickname)),
|
||||||
'class' => 'more'),
|
'class' => 'more'),
|
||||||
_('All groups'));
|
_('All groups'));
|
||||||
$this->elementEnd('p');
|
$this->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementEnd('div');
|
Event::handle('EndShowGroupsMiniList', array($this));
|
||||||
|
}
|
||||||
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,18 +273,12 @@ class ProfileListItem extends Widget
|
||||||
$usf = new UnsubscribeForm($this->out, $this->profile);
|
$usf = new UnsubscribeForm($this->out, $this->profile);
|
||||||
$usf->show();
|
$usf->show();
|
||||||
} else {
|
} else {
|
||||||
$other = User::staticGet('id', $this->profile->id);
|
// We can't initiate sub for a remote OMB profile.
|
||||||
if (!empty($other)) {
|
$remote = Remote_profile::staticGet('id', $this->profile->id);
|
||||||
|
if (empty($remote)) {
|
||||||
$sf = new SubscribeForm($this->out, $this->profile);
|
$sf = new SubscribeForm($this->out, $this->profile);
|
||||||
$sf->show();
|
$sf->show();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$url = common_local_url('remotesubscribe',
|
|
||||||
array('nickname' => $this->profile->nickname));
|
|
||||||
$this->out->element('a', array('href' => $url,
|
|
||||||
'class' => 'entity_remote_subscribe'),
|
|
||||||
_('Subscribe'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,7 +853,7 @@ function common_valid_profile_tag($str)
|
||||||
function common_group_link($sender_id, $nickname)
|
function common_group_link($sender_id, $nickname)
|
||||||
{
|
{
|
||||||
$sender = Profile::staticGet($sender_id);
|
$sender = Profile::staticGet($sender_id);
|
||||||
$group = User_group::getForNickname($nickname);
|
$group = User_group::getForNickname($nickname, $sender);
|
||||||
if ($sender && $group && $sender->isMember($group)) {
|
if ($sender && $group && $sender->isMember($group)) {
|
||||||
$attrs = array('href' => $group->permalink(),
|
$attrs = array('href' => $group->permalink(),
|
||||||
'class' => 'url');
|
'class' => 'url');
|
||||||
|
|
|
@ -436,16 +436,7 @@ class FacebookPlugin extends Plugin
|
||||||
function onStartPrimaryNav($action)
|
function onStartPrimaryNav($action)
|
||||||
{
|
{
|
||||||
if (self::hasKeys()) {
|
if (self::hasKeys()) {
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
|
||||||
$connect = 'FBConnectSettings';
|
|
||||||
if (common_config('xmpp', 'enabled')) {
|
|
||||||
$connect = 'imsettings';
|
|
||||||
} else if (common_config('sms', 'enabled')) {
|
|
||||||
$connect = 'smssettings';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
|
|
||||||
$fbuid = $this->loggedIn();
|
$fbuid = $this->loggedIn();
|
||||||
|
@ -472,7 +463,6 @@ class FacebookPlugin extends Plugin
|
||||||
'src' => $iconurl));
|
'src' => $iconurl));
|
||||||
|
|
||||||
$action->elementEnd('li');
|
$action->elementEnd('li');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,23 +307,14 @@ class MobileProfilePlugin extends WAP20Plugin
|
||||||
function _showPrimaryNav($action)
|
function _showPrimaryNav($action)
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
$connect = '';
|
|
||||||
if (common_config('xmpp', 'enabled')) {
|
|
||||||
$connect = 'imsettings';
|
|
||||||
} else if (common_config('sms', 'enabled')) {
|
|
||||||
$connect = 'smssettings';
|
|
||||||
}
|
|
||||||
|
|
||||||
$action->elementStart('ul', array('id' => 'site_nav_global_primary'));
|
$action->elementStart('ul', array('id' => 'site_nav_global_primary'));
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$action->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
|
$action->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
|
||||||
_('Home'));
|
_('Home'));
|
||||||
$action->menuItem(common_local_url('profilesettings'),
|
$action->menuItem(common_local_url('profilesettings'),
|
||||||
_('Account'));
|
_('Account'));
|
||||||
if ($connect) {
|
$action->menuItem(common_local_url('oauthconnectionssettings'),
|
||||||
$action->menuItem(common_local_url($connect),
|
|
||||||
_('Connect'));
|
_('Connect'));
|
||||||
}
|
|
||||||
if ($user->hasRight(Right::CONFIGURESITE)) {
|
if ($user->hasRight(Right::CONFIGURESITE)) {
|
||||||
$action->menuItem(common_local_url('siteadminpanel'),
|
$action->menuItem(common_local_url('siteadminpanel'),
|
||||||
_('Admin'), _('Change site configuration'), false, 'nav_admin');
|
_('Admin'), _('Change site configuration'), false, 'nav_admin');
|
||||||
|
|
|
@ -111,11 +111,11 @@ class OStatusPlugin extends Plugin
|
||||||
$acct = 'acct:'. $action->profile->nickname .'@'. common_config('site', 'server');
|
$acct = 'acct:'. $action->profile->nickname .'@'. common_config('site', 'server');
|
||||||
$url = common_local_url('xrd');
|
$url = common_local_url('xrd');
|
||||||
$url.= '?uri='. $acct;
|
$url.= '?uri='. $acct;
|
||||||
|
|
||||||
header('Link: <'.$url.'>; rel="'. Discovery::LRDD_REL.'"; type="application/xrd+xml"');
|
header('Link: <'.$url.'>; rel="'. Discovery::LRDD_REL.'"; type="application/xrd+xml"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up a PuSH hub link to our internal link for canonical timeline
|
* Set up a PuSH hub link to our internal link for canonical timeline
|
||||||
* Atom feeds for users and groups.
|
* Atom feeds for users and groups.
|
||||||
|
@ -229,7 +229,6 @@ class OStatusPlugin extends Plugin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we've got remote replies to send via Salmon.
|
* Check if we've got remote replies to send via Salmon.
|
||||||
*
|
*
|
||||||
|
@ -587,7 +586,6 @@ class OStatusPlugin extends Plugin
|
||||||
// Drop the PuSH subscription if there are no other subscribers.
|
// Drop the PuSH subscription if there are no other subscribers.
|
||||||
$oprofile->garbageCollect();
|
$oprofile->garbageCollect();
|
||||||
|
|
||||||
|
|
||||||
$member = Profile::staticGet($user->id);
|
$member = Profile::staticGet($user->id);
|
||||||
|
|
||||||
$act = new Activity();
|
$act = new Activity();
|
||||||
|
@ -738,6 +736,13 @@ class OStatusPlugin extends Plugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onEndShowGroupsMiniList($action)
|
||||||
|
{
|
||||||
|
$this->showEntityRemoteSubscribe($action);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function showEntityRemoteSubscribe($action)
|
function showEntityRemoteSubscribe($action)
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
@ -747,7 +752,7 @@ class OStatusPlugin extends Plugin
|
||||||
'class' => 'entity_subscribe'));
|
'class' => 'entity_subscribe'));
|
||||||
$action->element('a', array('href' => common_local_url('ostatussub'),
|
$action->element('a', array('href' => common_local_url('ostatussub'),
|
||||||
'class' => 'entity_remote_subscribe')
|
'class' => 'entity_remote_subscribe')
|
||||||
, _m('New'));
|
, _m('Remote'));
|
||||||
$action->elementEnd('p');
|
$action->elementEnd('p');
|
||||||
$action->elementEnd('div');
|
$action->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
@ -799,4 +804,28 @@ class OStatusPlugin extends Plugin
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onStartProfileListItemActionElements($item)
|
||||||
|
{
|
||||||
|
if (!common_logged_in()) {
|
||||||
|
|
||||||
|
$profileUser = User::staticGet('id', $item->profile->id);
|
||||||
|
|
||||||
|
if (!empty($profileUser)) {
|
||||||
|
|
||||||
|
$output = $item->out;
|
||||||
|
|
||||||
|
// Add an OStatus subscribe
|
||||||
|
$output->elementStart('li', 'entity_subscribe');
|
||||||
|
$url = common_local_url('ostatusinit',
|
||||||
|
array('nickname' => $profileUser->nickname));
|
||||||
|
$output->element('a', array('href' => $url,
|
||||||
|
'class' => 'entity_remote_subscribe'),
|
||||||
|
_m('Subscribe'));
|
||||||
|
$output->elementEnd('li');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,9 @@ min-width:96px;
|
||||||
#entity_remote_subscribe {
|
#entity_remote_subscribe {
|
||||||
padding:0;
|
padding:0;
|
||||||
float:right;
|
float:right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section #entity_remote_subscribe {
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user