Add support for virtualUsers (Matrix)
Add support for virtualUsers
(Matrix)
Fix #1076 (closed)

Dev notes
"virtualUser": {
"type": "matrix",
"externalId": "madlittlemods:matrix.org",
"displayName": "madlittlemods (Eric Eastwood)",
"avatarUrl": "https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/bDayqThxTIcGNcskzIADknRv?width=30&height=30&method=crop"
},
Matrix avatars
https://matrix.org/docs/api/client-server/#!/User32data/getAvatarUrl
https://matrix-client.matrix.org/_matrix/client/r0/profile/%40madlittlemods%3Amatrix.org/avatar_url
{
// Where `matrix.org` and `bDayqThxTIcGNcskzIADknRv` are used in the next media request
"avatar_url": "mxc://matrix.org/bDayqThxTIcGNcskzIADknRv"
}
https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/bDayqThxTIcGNcskzIADknRv?width=30&height=30&method=crop
Todo
- Add flair/badges
- Threaded conversation
- Add tests
-
Create
matrix-bridge-prod
,matrix-bridge-beta
OAuth clients
Future iterations (will create follow-up issues for these):
- Room bans -> #2615 (closed)
- Spam detection -> #2616
- Chat message reports -> #2624 (closed)
- Typeahead -> #2617
- Mentions -> #2618
- Search -> #2619
- User popover -> #2620 (closed)
- Unread notification emails -> #2621 (closed)
- Avatar sizes -> #2614
Testing strategy
- Create the OAuth client
db.oauthclients.insert({ clientKey: 'matrix-bridge-dev', clientSecret: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), name: 'Matrix bridge OAuth app', tag: 'matrix-bridge-dev' })
- Create a OAuth access token to use in our bridge
db.oauthaccesstokens.insert({ token: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), clientId: db.oauthclients.findOne({clientKey: 'matrix-bridge-dev' })._id, userId: db.users.findOne({ username: 'gitter-badger' })._id })
- You can find the token you just inserted with
db.oauthaccesstokens.find({ clientId: db.oauthclients.findOne({clientKey: 'matrix-bridge-dev' })._id }, { token: 1 })
- Test sending a message
POST http://localhost:5000/api/v1/rooms/5f7e2bc53279998d575e3546/chatMessages
(Authorization: Bearer xxx
,Content-Type: application/json
) with body:{ "virtualUser": { "type": "matrix", "externalId": "madlittlemods:matrix.org", "displayName": "madlittlemods (Eric Eastwood)", "avatarUrl": "https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/bDayqThxTIcGNcskzIADknRv?width=30&height=30&method=crop" }, "text": "some message" }
- To test with threaded conversations: Find a message to thread on and add
parentId: <that parent message ID>
to the request above
- virtual users