mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-25 00:30:59 +00:00
Fixes various issues with pinned posts (#580)
This commit is contained in:
parent
5297b98273
commit
9bc18a1190
2 changed files with 15 additions and 4 deletions
|
@ -760,11 +760,22 @@ class Identity(StatorModel):
|
|||
|
||||
try:
|
||||
data = canonicalise(response.json(), include_security=True)
|
||||
items: list[dict | str] = []
|
||||
if "orderedItems" in data:
|
||||
return [item["id"] for item in reversed(data["orderedItems"])]
|
||||
items = list(reversed(data["orderedItems"]))
|
||||
elif "items" in data:
|
||||
return [item["id"] for item in data["items"]]
|
||||
return []
|
||||
items = list(data["items"])
|
||||
|
||||
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:
|
||||
# Some servers return these with a 200 status code!
|
||||
if b"not found" in response.content.lower():
|
||||
|
|
|
@ -185,7 +185,7 @@ class IdentityService:
|
|||
}
|
||||
|
||||
def sync_pins(self, object_uris):
|
||||
if not object_uris:
|
||||
if not object_uris or self.identity.domain.blocked:
|
||||
return
|
||||
|
||||
with transaction.atomic():
|
||||
|
|
Loading…
Reference in a new issue