Mastodon: TWBlue should be able to ignore deleted messages, so it will load everything else properly

This commit is contained in:
Manuel Cortez 2023-12-31 14:45:05 -06:00
parent 8b5c47da28
commit e835274ce9
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
3 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,7 @@ TWBlue Changelog
* Added possibility to vote in polls.
* Added posts search. Take into account that Mastodon instances should be configured with full text search enabled. Search for posts only include posts the logged-in user has interacted with. ([#541](https://github.com/MCV-Software/TWBlue/pull/541))
* Added user autocompletion settings in account settings dialog, so it is possible to ask TWBlue to scan mastodon accounts and add people from followers and following buffers. For now, user autocompletion can be used only when composing new posts or replies.
* TWBlue should be able to ignore deleted direct messages or messages from deleted accounts. Previously, a direct message that no longer existed in the instance caused errors when loading the direct messages buffer and could potentially affect notifications as well.
## changes in version 2023.4.13

View File

@ -12,3 +12,4 @@
* Added possibility to vote in polls.
* Added posts search. Take into account that Mastodon instances should be configured with full text search enabled. Search for posts only include posts the logged-in user has interacted with. ([#541](https://github.com/MCV-Software/TWBlue/pull/541))
* Added user autocompletion settings in account settings dialog, so it is possible to ask TWBlue to scan mastodon accounts and add people from followers and following buffers. For now, user autocompletion can be used only when composing new posts or replies.
* TWBlue should be able to ignore deleted direct messages or messages from deleted accounts. Previously, a direct message that no longer existed in the instance caused errors when loading the direct messages buffer and could potentially affect notifications as well.

View File

@ -51,7 +51,7 @@ class ConversationListBuffer(BaseBuffer):
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
results.reverse()
except Exception as e:
log.exception("Error %s" % (str(e)))
log.exception("Error %s loading %s with args of %r and kwargs of %r" % (str(e), self.function, self.args, self.kwargs))
return
new_position, number_of_items = self.order_buffer(results)
log.debug("Number of items retrieved: %d" % (number_of_items,))
@ -110,6 +110,9 @@ class ConversationListBuffer(BaseBuffer):
self.session.db[self.name] = []
objects = self.session.db[self.name]
for i in data:
# Deleted conversations handling.
if i.last_status == None:
continue
position = self.get_item_position(i)
if position != None:
conversation = self.session.db[self.name][position]