mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Add migration for bugfix
This commit is contained in:
parent
786a709a40
commit
119bbdcede
1 changed files with 31 additions and 0 deletions
|
@ -318,3 +318,34 @@ class _20190901_MetaHashtagsAndMentions(Migration):
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(f"failed to process activity {data!r}")
|
logger.exception(f"failed to process activity {data!r}")
|
||||||
|
|
||||||
|
|
||||||
|
class _20190906_RedoFollowFollowBack(_20190901_FollowFollowBackMigrationFix):
|
||||||
|
"""Add the new meta flags for tracking accepted/rejected status and following/follows back info."""
|
||||||
|
|
||||||
|
|
||||||
|
class _20190906_InReplyToMigration(Migration):
|
||||||
|
def migrate(self) -> None:
|
||||||
|
for data in find_activities(
|
||||||
|
{**by_type(ap.ActivityType.CREATE), **not_deleted()}
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
in_reply_to = data["activity"]["object"].get("inReplyTo")
|
||||||
|
if in_reply_to:
|
||||||
|
update_one_activity(
|
||||||
|
by_remote_id(data["remote_id"]),
|
||||||
|
upsert({MetaKey.IN_REPLY_TO: in_reply_to}),
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f"failed to process activity {data!r}")
|
||||||
|
|
||||||
|
for data in DB.replies.find({**not_deleted()}):
|
||||||
|
try:
|
||||||
|
in_reply_to = data["activity"].get("inReplyTo")
|
||||||
|
if in_reply_to:
|
||||||
|
DB.replies.update_one(
|
||||||
|
by_remote_id(data["remote_id"]),
|
||||||
|
upsert({MetaKey.IN_REPLY_TO: in_reply_to}),
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f"failed to process activity {data!r}")
|
||||||
|
|
Loading…
Reference in a new issue