|
|
|
@ -308,6 +308,16 @@
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param CommunityRoom[] $rooms
|
|
|
|
|
*/
|
|
|
|
|
public static function sort_stickied_rooms_first(array &$rooms) {
|
|
|
|
|
global $STICKIED_ROOMS;
|
|
|
|
|
usort($rooms, function(CommunityRoom $a, CommunityRoom $b) use ($STICKIED_ROOMS) {
|
|
|
|
|
return $b->matched_by_list($STICKIED_ROOMS) - $a->matched_by_list($STICKIED_ROOMS);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return all known Community staff Session IDs.
|
|
|
|
|
* @return string[]
|
|
|
|
@ -403,13 +413,6 @@
|
|
|
|
|
return "$token+$server_id";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether this room belongs to a Session-owned server.
|
|
|
|
|
*/
|
|
|
|
|
function is_official_room(): bool {
|
|
|
|
|
return $this->server->is_official_server();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add string tags to the Community.
|
|
|
|
|
* @param string[] $tags
|
|
|
|
@ -526,6 +529,13 @@
|
|
|
|
|
return $rooms;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether this room belongs to a Session-owned server.
|
|
|
|
|
*/
|
|
|
|
|
function is_official_room(): bool {
|
|
|
|
|
return $this->server->is_official_server();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check whether the Community's text fields contain adult keywords.
|
|
|
|
|
*/
|
|
|
|
@ -562,6 +572,11 @@
|
|
|
|
|
return in_array("test", $this->string_tags) || $this->matched_by_list($TESTING_INCLUDE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function is_stickied_room(): bool {
|
|
|
|
|
global $STICKIED_ROOMS;
|
|
|
|
|
return $this->matched_by_list($STICKIED_ROOMS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine the safety of the Community's icon.
|
|
|
|
|
* @return 1 if safe, -1 if unsafe, 0 if unknown.
|
|
|
|
@ -627,7 +642,7 @@
|
|
|
|
|
* @return CommunityTag[] Array of tags.
|
|
|
|
|
*/
|
|
|
|
|
private function get_derived_tags(): array {
|
|
|
|
|
global $ROOMS_USED_BY_PROJECT, $TESTING_INCLUDE;
|
|
|
|
|
global $ROOMS_USED_BY_PROJECT, $TESTING_INCLUDE, $STICKIED_ROOMS;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var CommunityTag[] $derived_tags
|
|
|
|
@ -636,10 +651,18 @@
|
|
|
|
|
|
|
|
|
|
$USERS_PER_STAFF_WARNING = CommunityRoom::USERS_PER_STAFF_WARNING;
|
|
|
|
|
|
|
|
|
|
if (in_array($this->get_room_identifier(), $ROOMS_USED_BY_PROJECT)) {
|
|
|
|
|
$derived_tags[] = ReservedTags::used_by_project();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->is_official_room()) {
|
|
|
|
|
$derived_tags[] = ReservedTags::official();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->is_stickied_room()) {
|
|
|
|
|
$derived_tags[] = ReservedTags::stickied();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->rated_nsfw()) {
|
|
|
|
|
$derived_tags[] = ReservedTags::nsfw();
|
|
|
|
|
}
|
|
|
|
@ -660,14 +683,11 @@
|
|
|
|
|
$derived_tags[] = ReservedTags::recently_created();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (in_array($this->get_room_identifier(), $ROOMS_USED_BY_PROJECT)) {
|
|
|
|
|
$derived_tags[] = ReservedTags::used_by_project();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->is_testing_room()) {
|
|
|
|
|
$derived_tags[] = ReservedTags::testing();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $derived_tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|