diff options
author | Michael Manfre | 2022-11-26 12:09:31 -0500 |
---|---|---|
committer | GitHub | 2022-11-26 10:09:31 -0700 |
commit | 849c221aeeee89bdb61a88b4e6080481ecfeb934 (patch) | |
tree | 323b5a720adf214f4bbbbdaadbcd30249bcdcec5 /activities/models | |
parent | c7588583927e004e10599912f6d7b76413d52730 (diff) | |
download | takahe-849c221aeeee89bdb61a88b4e6080481ecfeb934.tar.gz takahe-849c221aeeee89bdb61a88b4e6080481ecfeb934.tar.bz2 takahe-849c221aeeee89bdb61a88b4e6080481ecfeb934.zip |
Local-only posting
Diffstat (limited to 'activities/models')
-rw-r--r-- | activities/models/post.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activities/models/post.py b/activities/models/post.py index dd82bcf..f75c526 100644 --- a/activities/models/post.py +++ b/activities/models/post.py @@ -64,6 +64,7 @@ class Post(StatorModel): class Visibilities(models.IntegerChoices): public = 0 + local_only = 4 unlisted = 1 followers = 2 mentioned = 3 @@ -261,6 +262,9 @@ class Post(StatorModel): mentions.add(identity) if reply_to: mentions.add(reply_to.author) + # Maintain local-only for replies + if reply_to.visibility == reply_to.Visibilities.local_only: + visibility = reply_to.Visibilities.local_only # Strip all HTML and apply linebreaks filter content = linebreaks_filter(strip_html(content)) # Make the Post object @@ -361,11 +365,12 @@ class Post(StatorModel): reply_post = await self.ain_reply_to_post() if reply_post: targets.add(reply_post.author) - # If this is a remote post, filter to only include local identities - if not self.local: + # If this is a remote post or local-only, filter to only include + # local identities + if not self.local or self.visibility == Post.Visibilities.local_only: targets = {target for target in targets if target.local} # If it's a local post, include the author - else: + if self.local: targets.add(self.author) return targets |