From 0fd49d2aea91781dba01b2ab4e74277d13a2abaf Mon Sep 17 00:00:00 2001 From: Christof Dorner Date: Fri, 17 Feb 2023 19:23:04 +0100 Subject: [PATCH] Mark Hashtag.name field as deduplication field This ensures that when an existing hashtag comes in through ActivityPub federation, it correctly finds the local one, instead of creating duplicate hashtags. --- bookwyrm/models/hashtag.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bookwyrm/models/hashtag.py b/bookwyrm/models/hashtag.py index d1ede638c..7894a3528 100644 --- a/bookwyrm/models/hashtag.py +++ b/bookwyrm/models/hashtag.py @@ -9,7 +9,11 @@ class Hashtag(ActivitypubMixin, BookWyrmModel): "a hashtag which can be used in statuses" name = CICharField( - max_length=256, blank=False, null=False, activitypub_field="name" + max_length=256, + blank=False, + null=False, + activitypub_field="name", + deduplication_field=True, ) name_field = "name"