1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-09-29 04:35:54 -04:00

Boosted polls weren't working; this change fixes that.

This commit is contained in:
Daniel Schwarz 2023-02-15 10:14:41 -05:00
parent a937650894
commit 68cadd4053
2 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ class Poll(urwid.ListBox):
self.status = status self.status = status
self.app = app self.app = app
self.user = user self.user = user
self.poll = status.data.get("poll") self.poll = status.original.data.get("poll")
self.button_group = [] self.button_group = []
self.api_exception = None self.api_exception = None
self.setup_listbox() self.setup_listbox()
@ -30,7 +30,7 @@ class Poll(urwid.ListBox):
return urwid.LineBox(contents) return urwid.LineBox(contents)
def vote(self, button_widget): def vote(self, button_widget):
poll = self.status.data.get("poll") poll = self.status.original.data.get("poll")
choices = [] choices = []
for idx, button in enumerate(self.button_group): for idx, button in enumerate(self.button_group):
if button.get_state(): if button.get_state():
@ -39,7 +39,7 @@ class Poll(urwid.ListBox):
if len(choices): if len(choices):
try: try:
response = api.vote(self.app, self.user, poll["id"], choices=choices) response = api.vote(self.app, self.user, poll["id"], choices=choices)
self.status.data["poll"] = response self.status.original.data["poll"] = response
self.api_exception = None self.api_exception = None
self.poll["voted"] = True self.poll["voted"] = True
self.poll["own_votes"] = choices self.poll["own_votes"] = choices

View File

@ -104,7 +104,7 @@ class Timeline(urwid.Columns):
if not status: if not status:
return None return None
poll = status.data.get("poll") poll = status.original.data.get("poll")
options = [ options = [
"[A]ccount" if not status.is_mine else "", "[A]ccount" if not status.is_mine else "",
@ -256,7 +256,7 @@ class Timeline(urwid.Columns):
return return
if key in ("p", "P"): if key in ("p", "P"):
poll = status.data.get("poll") poll = status.original.data.get("poll")
if poll and not poll["expired"]: if poll and not poll["expired"]:
self._emit("poll", status) self._emit("poll", status)
return return
@ -353,7 +353,7 @@ class StatusDetails(urwid.Pile):
yield ("pack", urwid.Text(m["description"])) yield ("pack", urwid.Text(m["description"]))
yield ("pack", urwid.Text(("link", m["url"]))) yield ("pack", urwid.Text(("link", m["url"])))
poll = status.data.get("poll") poll = status.original.data.get("poll")
if poll: if poll:
yield ("pack", urwid.Divider()) yield ("pack", urwid.Divider())
yield ("pack", self.build_linebox(self.poll_generator(poll))) yield ("pack", self.build_linebox(self.poll_generator(poll)))