Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
webapp
webapp
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 673
    • Issues 673
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 27
    • Merge Requests 27
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gitter
  • webappwebapp
  • Merge Requests
  • !2027

Merged
Opened Oct 02, 2020 by Eric Eastwood@MadLittleModsOwner4 of 13 tasks completed4/13 tasks

Add support for virtualUsers (Matrix)

  • Overview 28
  • Commits 1
  • Pipelines 19
  • Changes 29

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

  1. 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'
    })
  2. 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
    })
  3. You can find the token you just inserted with db.oauthaccesstokens.find({ clientId: db.oauthclients.findOne({clientKey: 'matrix-bridge-dev' })._id }, { token: 1 })
  4. 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"
    }
  5. To test with threaded conversations: Find a message to thread on and add parentId: <that parent message ID> to the request above

  • virtual users
Edited Oct 23, 2020 by Eric Eastwood
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Reference: gitterHQ/webapp!2027
Source branch: matrix-virtual-users