Move the Place activity to the location field (instead of a tag)

This commit is contained in:
Thomas Sileo
2019-11-06 22:40:51 +01:00
parent 9c12a67311
commit 3c4b9e7379
3 changed files with 49 additions and 39 deletions

View File

@@ -361,3 +361,18 @@ class _20191020_ManuallyApprovesFollowerSupportMigrationn(Migration):
},
{"$set": {"meta.follow_status": "accepted"}},
)
class _20191106_PlaceTagToLocation(Migration):
def migrate(self) -> None:
for data in find_activities({"activity.object.tag.type": "Place"}):
for tag in data["activity"]["object"]["tag"]:
if tag["type"] == "Place":
break
DB.activities.update_one(
{"_id": data["_id"]},
{
"$pull": {"activity.object.tag": {"type": "Place"}},
"$set": {"activity.object.location": tag},
},
)