mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-14 03:11:46 +00:00
Fixes various issues with pinned posts - continued (#581)
This commit is contained in:
parent
b2768e7f2e
commit
cec04e8ddb
2 changed files with 12 additions and 8 deletions
|
@ -771,7 +771,7 @@ class Identity(StatorModel):
|
|||
if not isinstance(item, dict):
|
||||
continue
|
||||
post_obj: dict | None = item
|
||||
if item["type"] == "Create":
|
||||
if item["type"] in ["Create", "Update"]:
|
||||
post_obj = item.get("object")
|
||||
if post_obj:
|
||||
ids.append(post_obj["id"])
|
||||
|
|
|
@ -190,6 +190,7 @@ class IdentityService:
|
|||
|
||||
with transaction.atomic():
|
||||
for object_uri in object_uris:
|
||||
try:
|
||||
post = Post.by_object_uri(object_uri, fetch=True)
|
||||
PostInteraction.objects.get_or_create(
|
||||
type=PostInteraction.Types.pin,
|
||||
|
@ -197,6 +198,9 @@ class IdentityService:
|
|||
post=post,
|
||||
state__in=PostInteractionStates.group_active(),
|
||||
)
|
||||
except Post.DoesNotExist:
|
||||
# ignore 404s...
|
||||
pass
|
||||
for removed in PostInteraction.objects.filter(
|
||||
type=PostInteraction.Types.pin,
|
||||
identity=self.identity,
|
||||
|
|
Loading…
Reference in a new issue