Fix poll bugs.

This commit is contained in:
Michelle Tang
2025-11-13 13:14:13 -05:00
parent 5bbc526923
commit 5ed4813331
4 changed files with 10 additions and 2 deletions

View File

@@ -2228,6 +2228,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
reactions.deleteReactions(MessageId(messageId))
deleteGroupStoryReplies(messageId)
disassociateStoryQuotes(messageId)
polls.deletePoll(messageId)
disassociatePollFromPollTerminate(polls.getPollTerminateMessageId(messageId))
val threadId = getThreadIdForMessage(messageId)

View File

@@ -700,6 +700,13 @@ class PollTables(context: Context?, databaseHelper: SignalDatabase?) : DatabaseT
.readToSingleBoolean()
}
fun deletePoll(messageId: Long) {
writableDatabase
.delete(PollTable.TABLE_NAME)
.where("${PollTable.MESSAGE_ID} = ?", messageId)
.run()
}
private fun isPending(pollId: Long, optionId: Long, voterId: Long): Boolean {
return readableDatabase
.exists(PollVoteTable.TABLE_NAME)