Mastodon: Load mentions only if the notification contains a post

This commit is contained in:
Manuel Cortez 2023-03-23 08:26:40 -06:00
parent 5749b4c8e3
commit d01856f436
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
2 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ We had to release a 2023.2.8 version of TWblue, which removes the API deprecatio
* 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))
* 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

View File

@ -28,6 +28,8 @@ class MentionsBuffer(BaseBuffer):
except Exception as e:
log.exception("Error %s" % (str(e)))
return
# Attempt to remove items with no statuses attached to them as it might happen when blocked accounts have notifications.
items = [item for item in items if item.status != None]
number_of_items = self.session.order_buffer(self.name, items)
log.debug("Number of items retrieved: %d" % (number_of_items,))
self.put_items_on_list(number_of_items)
@ -49,7 +51,8 @@ class MentionsBuffer(BaseBuffer):
except Exception as e:
log.exception("Error %s" % (str(e)))
return
print(items)
# Attempt to remove items with no statuses attached to them as it might happen when blocked accounts have notifications.
items = [item for item in items if item.status != None]
items_db = self.session.db[self.name]
for i in items:
if utils.find_item(i, self.session.db[self.name]) == None: