Skip to content

Commit

Permalink
Remove remnants of replace booth (#667)
Browse files Browse the repository at this point in the history
This was probably a nice idea we had back when üWave was first started.
A moderator would be able to instantly put a user in the booth, skipping
the waitlist.

In practice we never implemented it, and it would require client-side
support. I doubt it's all that useful and it is just dead code right
now.
  • Loading branch information
goto-bus-stop authored Nov 25, 2024
1 parent 4c25435 commit cbb6145
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 49 deletions.
35 changes: 0 additions & 35 deletions src/controllers/booth.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,40 +174,6 @@ async function leaveBooth(req) {
return toItemResponse({ autoLeave: value });
}

/**
* @typedef {object} ReplaceBoothBody
* @prop {UserID} userID
*/

/**
* @type {import('../types.js').AuthenticatedController<{}, {}, ReplaceBoothBody>}
*/
async function replaceBooth(req) {
const uw = req.uwave;
const moderatorID = req.user.id;
const { userID } = req.body;
let waitlist = await uw.redis.lrange('waitlist', 0, -1);

if (!waitlist.length) {
throw new HTTPError(404, 'Waitlist is empty.');
}

if (waitlist.includes(userID)) {
uw.redis.lrem('waitlist', 1, userID);
await uw.redis.lpush('waitlist', userID);
waitlist = await uw.redis.lrange('waitlist', 0, -1);
}

uw.publish('booth:replace', {
moderatorID,
userID,
});

await uw.booth.advance();

return toItemResponse({});
}

/**
* @param {import('../Uwave.js').default} uw
* @param {HistoryEntryID} historyEntryID
Expand Down Expand Up @@ -428,7 +394,6 @@ export {
getHistory,
getVote,
leaveBooth,
replaceBooth,
skipBooth,
socketVote,
vote,
Expand Down
4 changes: 0 additions & 4 deletions src/redisMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export type ServerActionParameters = {
moderatorID: UserID | null,
reason: string | null,
},
'booth:replace': {
userID: UserID,
moderatorID: UserID | null,
},

'chat:message': {
id: string,
Expand Down
10 changes: 0 additions & 10 deletions src/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,6 @@ export const leaveBooth = /** @type {const} */ ({
},
});

export const replaceBooth = /** @type {const} */ ({
body: {
type: 'object',
properties: {
userID: { $ref: 'https://ns.u-wave.net/schemas/definitions.json#/definitions/UUID' },
},
required: ['userID'],
},
});

export const getVote = /** @type {const} */ ({
params: {
type: 'object',
Expand Down

0 comments on commit cbb6145

Please sign in to comment.