cast ids to string since they're lexicographically sortable automatically in both systems
This commit is contained in:
parent
9c5eab51af
commit
937ed6b2b1
3 changed files with 6 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -183,3 +183,4 @@ cython_debug/
|
||||||
# Custom stuff
|
# Custom stuff
|
||||||
*.db
|
*.db
|
||||||
*.ini
|
*.ini
|
||||||
|
reference/
|
||||||
|
|
|
@ -74,13 +74,13 @@ class MisskeyService(FediverseService):
|
||||||
files = [self._convert_misskey_file(f) for f in note_data["files"]]
|
files = [self._convert_misskey_file(f) for f in note_data["files"]]
|
||||||
|
|
||||||
return FediversePost(
|
return FediversePost(
|
||||||
id=note_data.get("id", ""),
|
id=str(note_data.get("id", "")), # Misskey IDs (aid/meid/ulid/objectid) are lexicographically sortable as strings
|
||||||
text=note_data.get("text"),
|
text=note_data.get("text"),
|
||||||
user=self._convert_misskey_user(note_data.get("user", {})),
|
user=self._convert_misskey_user(note_data.get("user", {})),
|
||||||
visibility=self._convert_misskey_visibility(note_data.get("visibility", "home")),
|
visibility=self._convert_misskey_visibility(note_data.get("visibility", "home")),
|
||||||
created_at=note_data.get("createdAt"),
|
created_at=note_data.get("createdAt"),
|
||||||
files=files,
|
files=files,
|
||||||
reply_to_id=note_data.get("replyId")
|
reply_to_id=str(note_data.get("replyId", "")) if note_data.get("replyId") else None
|
||||||
)
|
)
|
||||||
|
|
||||||
def _convert_misskey_notification(self, notification_data: Dict[str, Any]) -> FediverseNotification:
|
def _convert_misskey_notification(self, notification_data: Dict[str, Any]) -> FediverseNotification:
|
||||||
|
@ -90,7 +90,7 @@ class MisskeyService(FediverseService):
|
||||||
post = self._convert_misskey_post(notification_data["note"])
|
post = self._convert_misskey_post(notification_data["note"])
|
||||||
|
|
||||||
return FediverseNotification(
|
return FediverseNotification(
|
||||||
id=notification_data.get("id", ""),
|
id=str(notification_data.get("id", "")), # Misskey IDs are lexicographically sortable as strings
|
||||||
type=self._convert_misskey_notification_type(notification_data.get("type", "")),
|
type=self._convert_misskey_notification_type(notification_data.get("type", "")),
|
||||||
user=self._convert_misskey_user(notification_data.get("user", {})),
|
user=self._convert_misskey_user(notification_data.get("user", {})),
|
||||||
post=post,
|
post=post,
|
||||||
|
|
|
@ -90,7 +90,7 @@ class PleromaService(FediverseService):
|
||||||
plain_text = re.sub(r'<[^>]+>', '', content) if content else None
|
plain_text = re.sub(r'<[^>]+>', '', content) if content else None
|
||||||
|
|
||||||
return FediversePost(
|
return FediversePost(
|
||||||
id=str(status_data.get("id", "")),
|
id=str(status_data.get("id", "")), # Pleroma IDs (snowflake format) are lexicographically sortable as strings
|
||||||
text=plain_text,
|
text=plain_text,
|
||||||
user=self._convert_mastodon_user(status_data.get("account", {})),
|
user=self._convert_mastodon_user(status_data.get("account", {})),
|
||||||
visibility=self._convert_mastodon_visibility(status_data.get("visibility", "public")),
|
visibility=self._convert_mastodon_visibility(status_data.get("visibility", "public")),
|
||||||
|
@ -106,7 +106,7 @@ class PleromaService(FediverseService):
|
||||||
post = self._convert_mastodon_status(notification_data["status"])
|
post = self._convert_mastodon_status(notification_data["status"])
|
||||||
|
|
||||||
return FediverseNotification(
|
return FediverseNotification(
|
||||||
id=str(notification_data.get("id", "")),
|
id=str(notification_data.get("id", "")), # Pleroma IDs are lexicographically sortable as strings
|
||||||
type=self._convert_mastodon_notification_type(notification_data.get("type", "")),
|
type=self._convert_mastodon_notification_type(notification_data.get("type", "")),
|
||||||
user=self._convert_mastodon_user(notification_data.get("account", {})),
|
user=self._convert_mastodon_user(notification_data.get("account", {})),
|
||||||
post=post,
|
post=post,
|
||||||
|
|
Loading…
Add table
Reference in a new issue