mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-25 23:18:51 -07:00
[api] fix ban duration display
This commit is contained in:
@@ -216,10 +216,11 @@ function banExpiry(
|
||||
* ROOM ban must never send it (`rooms` sends `IsBan: false` and is enforced by refusing the
|
||||
* room), because the client cannot tell the two apart and shows a game-wide ban screen.
|
||||
*
|
||||
* Its contents are {@link banBlockDetails} — the same `ReportCategory`, `Message` and the
|
||||
* `Duration`/`TimeoutStartedAt` pair `moderationBlockDetails` answers for this ban — so the
|
||||
* screen a player sees mid-session is the screen they see when they next sign in, not a
|
||||
* generic "banned" with no length.
|
||||
* Its contents are {@link banBlockDetails} — the same `ReportCategory`, `Message` and
|
||||
* `Duration` `moderationBlockDetails` answers for this ban — so the screen a player sees
|
||||
* mid-session is the screen they see when they next sign in, not a generic "banned" with no
|
||||
* length. `Duration` is the seconds LEFT, and this frame goes out the instant the ban is
|
||||
* handed down, so here that is the ban's whole span; every later sign-in gets less.
|
||||
*
|
||||
* Sent to anyone ONLINE, not only to a player standing in an instance: someone in a menu is
|
||||
* as banned as someone in a room. `GameSessionId` is their instance, or 0 when they are in
|
||||
|
||||
@@ -1280,14 +1280,16 @@ it('throws a banned player out of the instance they are standing in', async () =
|
||||
expect(frames[0].data.GameSessionId).toBe(77001)
|
||||
|
||||
// The SAME ban the sign-in screen describes, not a generic one: its category, message and
|
||||
// the Duration/TimeoutStartedAt pair, three days from when it was handed down.
|
||||
// `Duration` — the seconds LEFT, which at the instant the ban is handed down is the whole
|
||||
// three days. `TimeoutStartedAt` is not paired with it by the client and stays null.
|
||||
const banned = await getReportById(env.DB, report.id)
|
||||
expect(frames[0].data).toMatchObject({
|
||||
ReportCategory: banned!.report_category,
|
||||
Message: 'Rule violation',
|
||||
TimeoutStartedAt: banned!.banned_at,
|
||||
Duration: 3 * 86_400,
|
||||
TimeoutStartedAt: null,
|
||||
})
|
||||
expect(frames[0].data.Duration).toBeGreaterThan(3 * 86_400 - 5)
|
||||
expect(frames[0].data.Duration).toBeLessThanOrEqual(3 * 86_400)
|
||||
|
||||
// And they are out of that instance — moved into their own DORM, not deleted: `match`
|
||||
// lets a banned player matchmake there and nowhere else, so it is where they read the
|
||||
|
||||
Reference in New Issue
Block a user