More thoroughly exclude read-denied rooms

dev
gravel 11 months ago
parent f2d8d3e586
commit 648820b381
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -84,6 +84,11 @@
}
}
}
$rooms = array_filter($rooms, function(CommunityRoom $room) {
return !$room->room_is_off_record();
});
$listings[] = new CommunityListing(
$id,
$listing_props['name'],

@ -136,6 +136,13 @@
$this->description = substr($this->description, 0, strpos($this->description, $tag_specification));
}
/**
* Returns true if room should not be reflected in listings.
*/
function room_is_off_record(): bool {
return !$this->read;
}
/**
* Return information for JSON serialization.
*/

@ -17,7 +17,11 @@
function count_rooms(array $servers): int {
$rooms_total = 0;
foreach ($servers as $server) {
$rooms_total += count($server->rooms);
foreach ($server->rooms as $room) {
if (!$room->room_is_off_record()) {
$rooms_total += 1;
}
}
}
return $rooms_total;
}

@ -49,10 +49,8 @@
</tr>
<?php foreach ($rooms as $id => $room): ?>
<?php
if ($room->read) {
// Skip unreadable rooms.
// While not necessary, this hack can later allow SOGS
if ($room->room_is_off_record()) {
// This can later allow SOGS
// to pass server-wide info using hidden dummy rooms.
continue;
}

Loading…
Cancel
Save