Mastodon: Add attachments and reply settings to post when recovering from an error. Closes #527, #526, #377, #137, #108

This commit is contained in:
2023-04-03 16:03:20 -06:00
parent 52267562bc
commit 5f07f3b9d0
4 changed files with 6 additions and 3 deletions

View File

@@ -567,7 +567,7 @@ class BaseBuffer(base.Buffer):
return
poll = self.session.api_call(call_name="poll_vote", id=poll.id, choices=options, preexec_message=_("Sending vote..."))
def post_from_error(self, visibility, data):
def post_from_error(self, visibility, reply_to, data):
title = _("Post")
caption = _("Write your post here")
post = messages.post(session=self.session, title=title, caption=caption)
@@ -575,6 +575,6 @@ class BaseBuffer(base.Buffer):
response = post.message.ShowModal()
if response == wx.ID_OK:
post_data = post.get_data()
call_threaded(self.session.send_post, posts=post_data, visibility=post.get_visibility())
call_threaded(self.session.send_post, posts=post_data, reply_to=reply_to, visibility=post.get_visibility())
if hasattr(post.message, "destroy"):
post.message.destroy()

View File

@@ -1073,7 +1073,7 @@ class Controller(object):
def mastodon_error_post(self, name, reply_to, visibility, posts):
home = self.search_buffer("home_timeline", name)
if home != None:
wx.CallAfter(home.post_from_error, visibility=visibility, data=posts)
wx.CallAfter(home.post_from_error, visibility=visibility, reply_to=reply_to, data=posts)
def report_error(self, *args, **kwargs):
"""Redirects the user to the issue page on github"""

View File

@@ -79,6 +79,8 @@ class post(messages.basicMessage):
visibility_settings = dict(public=0, unlisted=1, private=2, direct=3)
self.message.visibility.SetSelection(visibility_settings.get(visibility))
self.message.on_sensitivity_changed()
for attachment in self.attachments:
self.message.add_item(item=[attachment["file"], attachment["type"], attachment["description"]])
self.text_processor()
def text_processor(self, *args, **kwargs):