Fix typecheck
This commit is contained in:
@@ -70,13 +70,14 @@ async function sendVotes(userOrID, channelID, pollMessageID, pollEventID) {
|
||||
return
|
||||
}
|
||||
|
||||
let userID, senderMxid
|
||||
if (typeof userOrID === "string") { // just a string when double-checking a vote removal - good thing the unvoter is already here from having voted
|
||||
var userID = userOrID
|
||||
var senderMxid = from("sim").join("sim_member", "mxid").where({user_id: userOrID, room_id: matchingRoomID}).pluck("mxid").get()
|
||||
userID = userOrID
|
||||
senderMxid = from("sim").join("sim_member", "mxid").where({user_id: userOrID, room_id: matchingRoomID}).pluck("mxid").get()
|
||||
if (!senderMxid) return
|
||||
} else { // sent in full when double-checking adding a vote, so we can properly ensure joined
|
||||
var userID = userOrID.id
|
||||
var senderMxid = await registerUser.ensureSimJoined(userOrID, matchingRoomID)
|
||||
userID = userOrID.id
|
||||
senderMxid = await registerUser.ensureSimJoined(userOrID, matchingRoomID)
|
||||
}
|
||||
|
||||
const answersArray = select("poll_vote", "matrix_option", {discord_or_matrix_user_id: userID, message_id: pollMessageID}).pluck().all()
|
||||
|
||||
@@ -19,7 +19,7 @@ const emitter = new EventEmitter()
|
||||
* Due to Eventual Consistency(TM) an update/delete may arrive before the original message arrives
|
||||
* (or before the it has finished being bridged to an event).
|
||||
* In this case, wait until the original message has finished bridging, then retrigger the passed function.
|
||||
* @template {(...args: any[]) => Promise<any>} T
|
||||
* @template {(...args: any[]) => any} T
|
||||
* @param {string} inputID
|
||||
* @param {T} fn
|
||||
* @param {Parameters<T>} rest
|
||||
|
||||
@@ -54,8 +54,8 @@ async function doSpeedbump(messageID) {
|
||||
debugSpeedbump(`[speedbump] DELETED ${messageID}`)
|
||||
return true
|
||||
}
|
||||
value = bumping.get(messageID) - 1
|
||||
if (value === 0) {
|
||||
value = (bumping.get(messageID) ?? 0) - 1
|
||||
if (value <= 0) {
|
||||
debugSpeedbump(`[speedbump] OK ${messageID}-- = ${value}`)
|
||||
bumping.delete(messageID)
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user