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

View File

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