diff --git a/doc/changelog.md b/doc/changelog.md index da0a6c2a..664c590a 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -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 diff --git a/src/controller/buffers/mastodon/mentions.py b/src/controller/buffers/mastodon/mentions.py index 52daa49f..33afbc5d 100644 --- a/src/controller/buffers/mastodon/mentions.py +++ b/src/controller/buffers/mastodon/mentions.py @@ -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: