isLocal() for User_group

This commit is contained in:
Mikael Nordfeldth 2014-05-19 14:46:54 +02:00
parent 37e57610fb
commit 1207f4f06f
2 changed files with 10 additions and 3 deletions

View File

@ -752,6 +752,8 @@ class User_group extends Managed_DataObject
// or we'll miss clearing some cache keys; that can make it hard
// to create a new group with one of those names or aliases.
$this->setAliases(array());
// $this->isLocal() but we're using the resulting object
$local = Local_group::getKV('group_id', $this->id);
if ($local instanceof Local_group) {
$local->delete();
@ -804,6 +806,12 @@ class User_group extends Managed_DataObject
$this->force_scope == 1);
}
public function isLocal()
{
$local = Local_group::getKV('group_id', $this->id);
return ($local instanceof Local_group);
}
static function groupsFromText($text, Profile $profile)
{
$groups = array();

View File

@ -1258,9 +1258,8 @@ class OStatusPlugin extends Plugin
public static function localGroupFromUrl($url)
{
$group = User_group::getKV('uri', $url);
if ($group) {
$local = Local_group::getKV('group_id', $group->id);
if ($local) {
if ($group instanceof User_group) {
if ($group->isLocal()) {
return $group->id;
}
} else {