diff options
author | Andrew Godwin | 2022-11-15 18:30:30 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-15 15:30:32 -0700 |
commit | 20e63023bb0d3c7e4cb36b91b73e79f51889cc90 (patch) | |
tree | 96c99139f03550e35902440cd321290bc47f8f0f /activities/models/timeline_event.py | |
parent | 4aa92744aea6097ffb784ca7de6bd95cc599988d (diff) | |
download | takahe-20e63023bb0d3c7e4cb36b91b73e79f51889cc90.tar.gz takahe-20e63023bb0d3c7e4cb36b91b73e79f51889cc90.tar.bz2 takahe-20e63023bb0d3c7e4cb36b91b73e79f51889cc90.zip |
Get outbound likes/boosts and their undos working
Diffstat (limited to 'activities/models/timeline_event.py')
-rw-r--r-- | activities/models/timeline_event.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activities/models/timeline_event.py b/activities/models/timeline_event.py index 6dba32c..29dec19 100644 --- a/activities/models/timeline_event.py +++ b/activities/models/timeline_event.py @@ -114,3 +114,20 @@ class TimelineEvent(models.Model): subject_identity_id=interaction.identity_id, subject_post_interaction=interaction, )[0] + + @classmethod + def delete_post_interaction(cls, identity, interaction): + if interaction.type == interaction.Types.like: + cls.objects.filter( + identity=identity, + type=cls.Types.liked, + subject_post_id=interaction.post_id, + subject_identity_id=interaction.identity_id, + ).delete() + elif interaction.type == interaction.Types.boost: + cls.objects.filter( + identity=identity, + type__in=[cls.Types.boosted, cls.Types.boost], + subject_post_id=interaction.post_id, + subject_identity_id=interaction.identity_id, + ).delete() |