diff --git a/doc/changelog.md b/doc/changelog.md index dfd87441..3f002df1 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -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)) * 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)) + * 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. ## Changes on version 2023.2.6 diff --git a/src/controller/buffers/mastodon/base.py b/src/controller/buffers/mastodon/base.py index 26947141..3d7d18e4 100644 --- a/src/controller/buffers/mastodon/base.py +++ b/src/controller/buffers/mastodon/base.py @@ -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() diff --git a/src/controller/mainController.py b/src/controller/mainController.py index a84a8773..192d3cc1 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -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""" diff --git a/src/controller/mastodon/messages.py b/src/controller/mastodon/messages.py index 44f0c072..e9137ff3 100644 --- a/src/controller/mastodon/messages.py +++ b/src/controller/mastodon/messages.py @@ -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):