mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
fix: preserve invites on nickname lookup failure
This commit is contained in:
1 parent
75893339c5
commit
efa0b85a0e
4 files changed
+45
-2
No files matched your search
@@ -333,6 +333,18 @@ export class WebSpeakDatabase {
|
||||
return rows.map(mapManagedInviteRow);
|
||||
}
|
||||
|
||||
getManagedInvite(tokenHash: string, now = Date.now()): ManagedInviteRecord | null {
|
||||
const nowIso = new Date(now).toISOString();
|
||||
const row = this.database.prepare(
|
||||
`SELECT * FROM managed_invites
|
||||
WHERE token_hash = ?
|
||||
AND revoked_at IS NULL
|
||||
AND expires_at > ?
|
||||
AND (max_uses = 0 OR use_count < max_uses)`,
|
||||
).get(tokenHash, nowIso) as ManagedInviteRow | undefined;
|
||||
return row ? mapManagedInviteRow(row) : null;
|
||||
}
|
||||
|
||||
revokeManagedInvite(id: string): boolean {
|
||||
const result = this.database.prepare(
|
||||
"UPDATE managed_invites SET revoked_at = ? WHERE id = ? AND revoked_at IS NULL",
|
||||
|
||||
Reference in new issue
Block a user