Fixes various issues with pinned posts (#580)
This commit is contained in:
parent
5297b98273
commit
9bc18a1190
|
@ -760,11 +760,22 @@ class Identity(StatorModel):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = canonicalise(response.json(), include_security=True)
|
data = canonicalise(response.json(), include_security=True)
|
||||||
|
items: list[dict | str] = []
|
||||||
if "orderedItems" in data:
|
if "orderedItems" in data:
|
||||||
return [item["id"] for item in reversed(data["orderedItems"])]
|
items = list(reversed(data["orderedItems"]))
|
||||||
elif "items" in data:
|
elif "items" in data:
|
||||||
return [item["id"] for item in data["items"]]
|
items = list(data["items"])
|
||||||
return []
|
|
||||||
|
ids = []
|
||||||
|
for item in items:
|
||||||
|
if not isinstance(item, dict):
|
||||||
|
continue
|
||||||
|
post_obj: dict | None = item
|
||||||
|
if item["type"] == "Create":
|
||||||
|
post_obj = item.get("object")
|
||||||
|
if post_obj:
|
||||||
|
ids.append(post_obj["id"])
|
||||||
|
return ids
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Some servers return these with a 200 status code!
|
# Some servers return these with a 200 status code!
|
||||||
if b"not found" in response.content.lower():
|
if b"not found" in response.content.lower():
|
||||||
|
|
|
@ -185,7 +185,7 @@ class IdentityService:
|
||||||
}
|
}
|
||||||
|
|
||||||
def sync_pins(self, object_uris):
|
def sync_pins(self, object_uris):
|
||||||
if not object_uris:
|
if not object_uris or self.identity.domain.blocked:
|
||||||
return
|
return
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
|
Loading…
Reference in New Issue