From 6924135fd361b16663e38a1b3269f238b3c08a6f Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:10:18 +0200 Subject: [PATCH] remove deleted gallery entries for recommendations --- .../content_discovery_currently_popular_gallery.py | 10 +++++++++- nostr_dvm/utils/definitions.py | 1 + setup.py | 2 +- tests/discovery_gallery.py | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py index 0f01e7d..8aad1f7 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py @@ -164,7 +164,7 @@ class DicoverContentCurrentlyPopularGallery(DVMTaskInterface): await cli.connect() filtreactions = Filter().kinds([definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REPOST, - definitions.EventDefinitions.KIND_REACTION, + definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_DELETION, definitions.EventDefinitions.KIND_NOTE]).events(ids).since(since) dbopts = NegentropyOptions().direction(NegentropyDirection.DOWN) @@ -179,6 +179,14 @@ class DicoverContentCurrentlyPopularGallery(DVMTaskInterface): for event in events: if event.created_at().as_secs() > timestamp_since: + filt1 = Filter().kinds([definitions.EventDefinitions.KIND_DELETION]).event(event.id()).limit(1) + deletions = await databasegallery.query([filt1]) + if len(deletions) > 0: + print("Deleted event, skipping") + continue + + + filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) diff --git a/nostr_dvm/utils/definitions.py b/nostr_dvm/utils/definitions.py index 6152f61..7eda511 100644 --- a/nostr_dvm/utils/definitions.py +++ b/nostr_dvm/utils/definitions.py @@ -9,6 +9,7 @@ class EventDefinitions: KIND_NOTE = Kind(1) KIND_FOLLOW_LIST = Kind(3) KIND_DM = Kind(4) + KIND_DELETION = Kind(5) KIND_REPOST = Kind(6) KIND_REACTION = Kind(7) KIND_NIP94_METADATA = Kind(1063) diff --git a/setup.py b/setup.py index 9e51fd8..d7464ce 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.7.10' +VERSION = '0.7.11' DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information') diff --git a/tests/discovery_gallery.py b/tests/discovery_gallery.py index 1f238c6..af11f72 100644 --- a/tests/discovery_gallery.py +++ b/tests/discovery_gallery.py @@ -12,9 +12,9 @@ from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.dvmconfig import build_default_config from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag -rebroadcast_NIP89 = True # Announce NIP89 on startup -rebroadcast_NIP65_Relay_List = True -update_profile = True +rebroadcast_NIP89 = False # Announce NIP89 on startup +rebroadcast_NIP65_Relay_List = False +update_profile = False global_update_rate = 1200 # set this high on first sync so db can fully sync before another process trys to. use_logger = True