X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FUser_group.php;h=f72cc57533db1f8eb3f526b2016b6be0788bfcc9;hb=2d2c134a1f464021f2b3d3837eac95521ac02af5;hp=4d6dcfab689d536834e7b79e7f3bc6ddb16f6e0f;hpb=c1a27922ba738f71b100a520e5db6f32985a307b;p=quix0rs-gnu-social.git diff --git a/classes/User_group.php b/classes/User_group.php index 4d6dcfab68..f72cc57533 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -28,6 +28,7 @@ class User_group extends Memcached_DataObject public $uri; // varchar(255) unique_key public $mainpage; // varchar(255) public $join_policy; // tinyint + public $force_scope; // tinyint /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User_group',$k,$v); } @@ -87,41 +88,11 @@ class User_group extends Memcached_DataObject function getNotices($offset, $limit, $since_id=null, $max_id=null) { - $stream = new NoticeStream(array($this, '_streamDirect'), - array(), - 'user_group:notice_ids:' . $this->id); + $stream = new GroupNoticeStream($this); return $stream->getNotices($offset, $limit, $since_id, $max_id); } - function _streamDirect($offset, $limit, $since_id, $max_id) - { - $inbox = new Group_inbox(); - - $inbox->group_id = $this->id; - - $inbox->selectAdd(); - $inbox->selectAdd('notice_id'); - - Notice::addWhereSinceId($inbox, $since_id, 'notice_id'); - Notice::addWhereMaxId($inbox, $max_id, 'notice_id'); - - $inbox->orderBy('created DESC, notice_id DESC'); - - if (!is_null($offset)) { - $inbox->limit($offset, $limit); - } - - $ids = array(); - - if ($inbox->find()) { - while ($inbox->fetch()) { - $ids[] = $inbox->notice_id; - } - } - - return $ids; - } function allowedNickname($nickname) { @@ -544,12 +515,19 @@ class User_group extends Memcached_DataObject $group->uri = $uri; $group->mainpage = $mainpage; $group->created = common_sql_now(); + if (isset($fields['join_policy'])) { $group->join_policy = intval($fields['join_policy']); } else { $group->join_policy = 0; } + if (isset($fields['force_scope'])) { + $group->force_scope = intval($fields['force_scope']); + } else { + $group->force_scope = 0; + } + if (Event::handle('StartGroupSave', array(&$group))) { $result = $group->insert(); @@ -673,4 +651,10 @@ class User_group extends Memcached_DataObject } parent::delete(); } + + function isPrivate() + { + return ($this->join_policy == self::JOIN_POLICY_MODERATE && + $this->force_scope == 1); + } }