mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-25 23:18:51 -07:00
[rooms] retain beta/limitsv2 tags after clone
This commit is contained in:
@@ -1750,8 +1750,9 @@ const app = new Hono<App>()
|
||||
'Copies a room’s content (scene, subrooms, settings) into a new room owned by the',
|
||||
'caller. Cloning is the only way to make a room, so the per-account room cap is',
|
||||
'enforced here — it counts the rooms the account created, minus their auto-provisioned',
|
||||
'dorm (`MAX_ROOMS_PER_ACCOUNT`; 0 lifts the cap). The clone starts with no tags,',
|
||||
'zeroed `Stats`, `IsRRO`/`IsDeveloperOwned`/`CloningAllowed` cleared, and PRIVATE accessibility — a new room is unpublished until its',
|
||||
'dorm (`MAX_ROOMS_PER_ACCOUNT`; 0 lifts the cap). The clone keeps only the source’s',
|
||||
'system tags (`Type` 1: `beta`, `limitsv2` — what the scene needs to run) and drops',
|
||||
'every other tag, and starts with zeroed `Stats`, `IsRRO`/`IsDeveloperOwned`/`CloningAllowed` cleared, and PRIVATE accessibility — a new room is unpublished until its',
|
||||
'owner sets its accessibility, so it never lands in the public feeds on creation.',
|
||||
'',
|
||||
'Rejections — a blank or taken name, the cap, a source that disallows cloning — are',
|
||||
|
||||
@@ -1334,6 +1334,14 @@ describe('rooms endpoints', () => {
|
||||
`UPDATE room SET data = json_set(data, '$.IsDeveloperOwned', json('true'),
|
||||
'$.CloningAllowed', json('true'), '$.Stats.VisitorCount', 42) WHERE room_id = 24`
|
||||
).run()
|
||||
// And every kind of tag: an owner tag flagged as the genre (Type 0), the server's
|
||||
// `rro` (Type 2), and the two system tags the client derives (Type 1).
|
||||
await env.DB.batch([
|
||||
env.DB.prepare(
|
||||
`INSERT OR REPLACE INTO room_tag (room_id, tag, type, is_primary_genre)
|
||||
VALUES (24, 'hangout', 0, 1), (24, 'rro', 2, 0), (24, 'beta', 1, 0), (24, 'limitsv2', 1, 0)`
|
||||
),
|
||||
])
|
||||
|
||||
// Clone MakerRoom (base, RoomId 24) → a fresh room owned by the caller (801).
|
||||
const ok = await post(24, 'MyMakerClone')
|
||||
@@ -1343,9 +1351,12 @@ describe('rooms endpoints', () => {
|
||||
expect(ok.value!.Name).toBe('MyMakerClone')
|
||||
expect(ok.value!.CreatorAccountId).toBe(801)
|
||||
expect(ok.value!.RoomId).toBeGreaterThan(51)
|
||||
// The clone starts fresh with no tags — none of the source's tags (including
|
||||
// the `base` template tag) carry over.
|
||||
expect(ok.value!.Tags).toEqual([])
|
||||
// Only the system tags (Type 1) carry over — the scene needs them to run. The
|
||||
// owner's tags, the `base` template tag, the derived `rro` and the genre flag don't.
|
||||
expect(ok.value!.Tags).toEqual([
|
||||
{ Tag: 'beta', Type: 1 },
|
||||
{ Tag: 'limitsv2', Type: 1 },
|
||||
])
|
||||
// IsRRO is cleared so the client doesn't render a virtual "RRO" tag on the clone.
|
||||
expect(ok.value!.IsRRO).toBe(false)
|
||||
// Nor is it developer-owned, and the new owner opts it into cloning themselves.
|
||||
@@ -1375,7 +1386,11 @@ describe('rooms endpoints', () => {
|
||||
Stats: Record<string, number>
|
||||
}
|
||||
expect(fetched.Name).toBe('MyMakerClone')
|
||||
expect(fetched.Tags).toEqual([])
|
||||
// The system tags were written to `room_tag`, so they survive a re-read.
|
||||
expect(fetched.Tags).toEqual([
|
||||
{ Tag: 'beta', Type: 1 },
|
||||
{ Tag: 'limitsv2', Type: 1 },
|
||||
])
|
||||
expect(fetched.IsDeveloperOwned).toBe(false)
|
||||
expect(fetched.CloningAllowed).toBe(false)
|
||||
expect(fetched.Stats.VisitorCount).toBe(0)
|
||||
|
||||
Reference in New Issue
Block a user