Send activitypub pure mode activities when possible

This commit is contained in:
Mouse Reeve 2021-02-09 12:23:59 -08:00
parent 0682117a06
commit 25e8b3ddeb

View file

@ -184,13 +184,21 @@ class ObjectMixin(ActivitypubMixin):
# broadcast Create activities for objects owned by a local user # broadcast Create activities for objects owned by a local user
if not user or not user.local: if not user or not user.local:
return return
try: try:
software = None
# do we have a "pure" activitypub version of this for mastodon?
if hasattr(self, 'pure_content'):
pure_activity = self.to_create_activity(user, pure=True)
self.broadcast(pure_activity, user, software='other')
software = 'bookwyrm'
# sends to BW only if we just did a pure version for masto
activity = self.to_create_activity(user) activity = self.to_create_activity(user)
self.broadcast(activity, user, software=software)
except KeyError: except KeyError:
# janky as heck, this catches the mutliple inheritence chain # janky as heck, this catches the mutliple inheritence chain
# for boosts and ignores this auxilliary broadcast # for boosts and ignores this auxilliary broadcast
return return
self.broadcast(activity, user)
return return
# --- updating an existing object # --- updating an existing object