mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 14:41:28 -07:00
[rooms] handle pseudo community tag
This commit is contained in:
@@ -1759,6 +1759,18 @@ function hotScore(room: Room, stats: Map<number, RoomStats>): number {
|
|||||||
*/
|
*/
|
||||||
const NEW_TAG = 'new'
|
const NEW_TAG = 'new'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The browse screen's "Community" chip posts `tag=community`, another PSEUDO-tag no
|
||||||
|
* room carries. It means "made by a player", which here is every room whose creator
|
||||||
|
* isn't the Coach account — the system account that owns the seeded Rec Room rooms.
|
||||||
|
* Unlike {@link NEW_TAG} it only filters: the page keeps the feed's normal
|
||||||
|
* live-population ordering.
|
||||||
|
*/
|
||||||
|
const COMMUNITY_TAG = 'community'
|
||||||
|
|
||||||
|
/** The system account (`Coach`) that owns the seeded first-party rooms. */
|
||||||
|
const COACH_ACCOUNT_ID = 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the room is a Rec Room Original. `IsRRO` is the flag the client renders a
|
* True if the room is a Rec Room Original. `IsRRO` is the flag the client renders a
|
||||||
* virtual "RRO" tag from; the auto-derived `rro` tag is checked too so a room that only
|
* virtual "RRO" tag from; the auto-derived `rro` tag is checked too so a room that only
|
||||||
@@ -1784,7 +1796,8 @@ function createdAt(room: Room): number {
|
|||||||
* skip/take; returns `{ Results, TotalResults }` like search. The dataset is
|
* skip/take; returns `{ Results, TotalResults }` like search. The dataset is
|
||||||
* small, so this filters/sorts in memory rather than in SQL.
|
* small, so this filters/sorts in memory rather than in SQL.
|
||||||
*
|
*
|
||||||
* `tag=new` is the one filter that isn't a tag lookup — see {@link NEW_TAG}.
|
* `tag=new` and `tag=community` are the filters that aren't tag lookups — see
|
||||||
|
* {@link NEW_TAG} and {@link COMMUNITY_TAG}.
|
||||||
*/
|
*/
|
||||||
export async function getHotRooms(
|
export async function getHotRooms(
|
||||||
db: D1Database,
|
db: D1Database,
|
||||||
@@ -1810,7 +1823,9 @@ export async function getHotRooms(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t !== '') {
|
if (t === COMMUNITY_TAG) {
|
||||||
|
rooms = rooms.filter((r) => r.CreatorAccountId !== COACH_ACCOUNT_ID)
|
||||||
|
} else if (t !== '') {
|
||||||
const accepted = new Set([t, ...(TAG_ALIASES[t] ?? [])])
|
const accepted = new Set([t, ...(TAG_ALIASES[t] ?? [])])
|
||||||
rooms = rooms.filter((r) => roomHasAnyTag(r, accepted))
|
rooms = rooms.filter((r) => roomHasAnyTag(r, accepted))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user