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

This commit is contained in:
Manuel Cortez 2023-04-03 16:03:20 -06:00
parent 52267562bc
commit 5f07f3b9d0
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
4 changed files with 6 additions and 3 deletions

View File

@ -7,6 +7,7 @@ During the development of the current TWBlue version, Twitter has cut out access
* TWBlue should be able to display variables within templates (for example, now it is possible to send a template inside a post's text). Before, it was removing $variables so it was difficult to show how to edit templates from the client. ([#515](https://github.com/MCV-Software/TWBlue/issues/515)) * TWBlue should be able to display variables within templates (for example, now it is possible to send a template inside a post's text). Before, it was removing $variables so it was difficult to show how to edit templates from the client. ([#515](https://github.com/MCV-Software/TWBlue/issues/515))
* Mastodon: * Mastodon:
* it is possible to add descriptions for all media available on Mastodon (audio, photos, video and Givs). ([#516](https://github.com/MCV-Software/TWBlue/issues/516)) * it is possible to add descriptions for all media available on Mastodon (audio, photos, video and Givs). ([#516](https://github.com/MCV-Software/TWBlue/issues/516))
* Added an experimetal feature to recover from connection errors. When making a post, if the post cannot be published due to any kind of error, TWBlue will bring up the dialog where the post was composed, so you can give the post a second chance or save the post's text. This feature should work for threads, posts with attachments, polls and replies. ([#527,](https://github.com/MCV-Software/TWBlue/issues/527) [#526,](https://github.com/MCV-Software/TWBlue/issues/526) [#377,](https://github.com/MCV-Software/TWBlue/issues/377) [#137,](https://github.com/MCV-Software/TWBlue/issues/137) [#108](https://github.com/MCV-Software/TWBlue/issues/108))
* Fixed an error on mentions buffer that was making TWBlue unable to load posts if there were mentions from a blocked or deleted account. * Fixed an error on mentions buffer that was making TWBlue unable to load posts if there were mentions from a blocked or deleted account.
## Changes on version 2023.2.6 ## Changes on version 2023.2.6

View File

@ -567,7 +567,7 @@ class BaseBuffer(base.Buffer):
return return
poll = self.session.api_call(call_name="poll_vote", id=poll.id, choices=options, preexec_message=_("Sending vote...")) 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") title = _("Post")
caption = _("Write your post here") caption = _("Write your post here")
post = messages.post(session=self.session, title=title, caption=caption) post = messages.post(session=self.session, title=title, caption=caption)
@ -575,6 +575,6 @@ class BaseBuffer(base.Buffer):
response = post.message.ShowModal() response = post.message.ShowModal()
if response == wx.ID_OK: if response == wx.ID_OK:
post_data = post.get_data() 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"): if hasattr(post.message, "destroy"):
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): def mastodon_error_post(self, name, reply_to, visibility, posts):
home = self.search_buffer("home_timeline", name) home = self.search_buffer("home_timeline", name)
if home != None: 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): def report_error(self, *args, **kwargs):
"""Redirects the user to the issue page on github""" """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) visibility_settings = dict(public=0, unlisted=1, private=2, direct=3)
self.message.visibility.SetSelection(visibility_settings.get(visibility)) self.message.visibility.SetSelection(visibility_settings.get(visibility))
self.message.on_sensitivity_changed() self.message.on_sensitivity_changed()
for attachment in self.attachments:
self.message.add_item(item=[attachment["file"], attachment["type"], attachment["description"]])
self.text_processor() self.text_processor()
def text_processor(self, *args, **kwargs): def text_processor(self, *args, **kwargs):