Fix party slow mode across account sessions
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 8m22s
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 8m22s
This commit is contained in:
@@ -102,7 +102,7 @@ try {
|
||||
"Guest",
|
||||
]);
|
||||
const roster = (await act(moderationRoom, 1)).players;
|
||||
const friend = roster.find((p) => p.name === "Account friend");
|
||||
let friend = roster.find((p) => p.name === "Account friend");
|
||||
let guest = roster.find((p) => p.name === "Guest");
|
||||
const community = async (who, action, payload = {}) =>
|
||||
(
|
||||
@@ -180,11 +180,33 @@ try {
|
||||
secret(3),
|
||||
"Guest",
|
||||
]);
|
||||
await community(1, "unadmin", { playerId: friend.id });
|
||||
await chat(2, "Signed-in player", randomUUID());
|
||||
await act(moderationRoom, 2, "leave");
|
||||
await db.query("select public.join_multiplayer_room($1,$2,$3,$4)", [
|
||||
moderationRoom,
|
||||
secret(8),
|
||||
secondAccount,
|
||||
"Ignored",
|
||||
]);
|
||||
await assert.rejects(
|
||||
chat(8, "Different browser", randomUUID()),
|
||||
/slow mode/,
|
||||
);
|
||||
await db.query(
|
||||
"update public.party_chat_account_cooldowns set last_message_at=clock_timestamp()-interval '11 seconds' where room_id=$1 and account_id=$2",
|
||||
[moderationRoom, secondAccount],
|
||||
);
|
||||
await chat(8, "Allowed after the delay", randomUUID());
|
||||
friend = (await act(moderationRoom, 1)).players.find(
|
||||
(p) => p.name === "Account friend",
|
||||
);
|
||||
assert.ok(friend);
|
||||
await community(1, "ban", { playerId: friend.id });
|
||||
await assert.rejects(
|
||||
db.query("select public.join_multiplayer_room($1,$2,$3,$4)", [
|
||||
moderationRoom,
|
||||
secret(8),
|
||||
secret(9),
|
||||
secondAccount,
|
||||
"Ignored",
|
||||
]),
|
||||
@@ -194,10 +216,14 @@ try {
|
||||
const privileges = (
|
||||
await db.query(`select
|
||||
has_table_privilege('anon','public.party_chat_cooldowns','select') as anon_read,
|
||||
has_table_privilege('authenticated','public.party_chat_cooldowns','select') as authenticated_read`)
|
||||
has_table_privilege('authenticated','public.party_chat_cooldowns','select') as authenticated_read,
|
||||
has_table_privilege('anon','public.party_chat_account_cooldowns','select') as anon_account_read,
|
||||
has_table_privilege('authenticated','public.party_chat_account_cooldowns','select') as authenticated_account_read`)
|
||||
).rows[0];
|
||||
assert.equal(privileges.anon_read, false);
|
||||
assert.equal(privileges.authenticated_read, false);
|
||||
assert.equal(privileges.anon_account_read, false);
|
||||
assert.equal(privileges.authenticated_account_read, false);
|
||||
await db.query("delete from public.multiplayer_rooms where id=$1", [
|
||||
moderationRoom,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user