Setup redirects from old Gitter chat message ID to the new Matrix event ID
Setup redirects from old Gitter chat message ID to the new Matrix event ID.
To do this properly, it would require standing up a database to lookup all of the bridged data but this is very cumbersome. It would be nice if we could do this in a stateless way.
Potential solution
Since a Gitter message ID is just a Mongo ObjectId, it has the timestamp built-in. We could have something extract the timestamp out and use some deep link into Element to jump to date which would probably get you very close.
Ideally, this would just be part of the nginx redirects. Hopefully the level of logic necessary to parse out the Mongo ObjectId would be possible.
Otherwise, it could be some stateless client-side static site where you enter in your Gitter permalink and it redirects you to the correct place.
Dev notes
See splitMongoObjectIdIntoPieces
. A Mongo ObjectId
is a 12-byte object containing 3 discrete pieces (reference https://www.mongodb.com/docs/manual/reference/method/ObjectId/):
- timestampSeconds: A 4-byte timestamp, representing the ObjectId's creation, measured in seconds since the Unix epoch.
- randomValuePerProcess: A 5-byte random value generated once per process. This random value is unique to the machine and process.
- incrementingValue: A 3-byte incrementing counter, initialized to a random value.
Or if you want to use the mongo
library, getDateFromObjectId
/getTimestampFromObjectId
TODO
-
Add a way to deep link jump to date into Element. Tracked by https://github.com/vector-im/element-web/issues/24914