Add migration for bugfix

This commit is contained in:
Thomas Sileo 2019-09-06 20:04:23 +02:00
parent 786a709a40
commit 119bbdcede

View file

@ -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}")