mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-25 08:41:00 +00:00
parent
5d6ff57b5f
commit
b8dca2b71f
1 changed files with 5 additions and 1 deletions
|
@ -712,7 +712,8 @@ class Post(StatorModel):
|
||||||
Retrieves a Post instance by its ActivityPub JSON object.
|
Retrieves a Post instance by its ActivityPub JSON object.
|
||||||
|
|
||||||
Optionally creates one if it's not present.
|
Optionally creates one if it's not present.
|
||||||
Raises KeyError if it's not found and create is False.
|
Raises DoesNotExist if it's not found and create is False,
|
||||||
|
or it's from a blocked domain.
|
||||||
"""
|
"""
|
||||||
# Do we have one with the right ID?
|
# Do we have one with the right ID?
|
||||||
created = False
|
created = False
|
||||||
|
@ -724,6 +725,9 @@ class Post(StatorModel):
|
||||||
if create:
|
if create:
|
||||||
# Resolve the author
|
# Resolve the author
|
||||||
author = Identity.by_actor_uri(data["attributedTo"], create=create)
|
author = Identity.by_actor_uri(data["attributedTo"], create=create)
|
||||||
|
# If the post is from a blocked domain, stop and drop
|
||||||
|
if author.domain.blocked:
|
||||||
|
raise cls.DoesNotExist("Post is from a blocked domain")
|
||||||
post = cls.objects.create(
|
post = cls.objects.create(
|
||||||
object_uri=data["id"],
|
object_uri=data["id"],
|
||||||
author=author,
|
author=author,
|
||||||
|
|
Loading…
Reference in a new issue