-
-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "show results" for polls #4980
base: develop
Are you sure you want to change the base?
Conversation
Tak
commented
Mar 7, 2025

setVoted(tuskyAccountId, statusId, moshi.adapter<Poll>().toJson(poll.copy(voted = true))) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this, but it feels better than adding another field and updating the "which poll view should I show" logic 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By this you mean setting the poll to voted when it isn't actually voted? I think that is fine.
But you could include the poll or the whole status in the PollShowResultsEvent
then you don't need the getStatus
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By this
I mean the function doing query/deserialize/update
It's not trivial to include more stuff in the PollShowResultsEvent
- the other events are created from a network call that includes those in the response from the server
I could pass the whole status into the StatusActionListener
callback I guess, but even then I'm not sure I always have it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
setVoted(tuskyAccountId, statusId, moshi.adapter<Poll>().toJson(poll.copy(voted = true))) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By this you mean setting the poll to voted when it isn't actually voted? I think that is fine.
But you could include the poll or the whole status in the PollShowResultsEvent
then you don't need the getStatus
here.
@@ -183,6 +183,16 @@ WHERE tuskyAccountId = :tuskyAccountId AND serverId = :statusId""" | |||
) | |||
abstract suspend fun setVoted(tuskyAccountId: Long, statusId: String, poll: String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found out that one can do this:
abstract suspend fun setVoted(tuskyAccountId: Long, statusId: String, poll: String) | |
@TypeConverters(Converters::class) | |
abstract suspend fun setVoted(tuskyAccountId: Long, statusId: String, poll: Poll) |
and then there is no more need for the manual json conversion with Moshi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩