Propagate visibility when posting status

This commit is contained in:
Ivan Habunek 2019-08-27 17:22:52 +02:00
parent 672bb5d008
commit 5ec8d9411d
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
3 changed files with 7 additions and 4 deletions

View File

@ -20,6 +20,8 @@ TODO/Ideas:
* convert to ascii art?
* use signals to avoid tightly coupling components
* interaction with clipboard - how to copy a status to clipbard?
* Show **notifications**
* Show **threads**
Questions:
* is it possible to make a span a urwid.Text selectable? e.g. for urls and hashtags

View File

@ -231,7 +231,7 @@ class TUI(urwid.Frame):
urwid.connect_signal(composer, "close",
lambda *args: self.close_overlay())
urwid.connect_signal(composer, "post",
lambda _, content, warning: self.post_status(content, warning))
lambda _, content, warning, visibility: self.post_status(content, warning, visibility))
self.open_overlay(
widget=composer,
title="Compose status",
@ -243,8 +243,9 @@ class TUI(urwid.Frame):
},
)
def post_status(self, content, warning):
data = api.post_status(self.app, self.user, content, spoiler_text=warning)
def post_status(self, content, warning, visibility):
data = api.post_status(self.app, self.user, content,
spoiler_text=warning, visibility=visibility)
status = Status(data, self.app.instance)
self.timeline.prepend_status(status)
self.footer.set_message("Status posted {} \\o/".format(status.id))

View File

@ -126,7 +126,7 @@ class StatusComposer(urwid.Frame):
self.set_error_message("Cannot post an empty message")
return
self._emit("post", content, warning)
self._emit("post", content, warning, self.visibility)
def close(self, button):
self._emit("close")