matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
https://matrix-org.github.io/matrix-hookshot/
Apache License 2.0
283 stars 68 forks source link

Fix GitLab's ready for review hook #936

Closed zecakeh closed 4 months ago

zecakeh commented 4 months ago

The code resulted on this error when there was a title change (rest of the stack trace omitted):

[Bridge] Connection GitLabRepo http://gitlab.local/group/website failed to handle gitlab.merge_request.update: TypeError: Cannot read properties of undefined (reading 'startsWith')
  at GitLabRepoConnection.onMergeRequestUpdate (~/Projets/matrix/hookshot/src/Connections/GitlabRepo.ts:630:53)

As far back as I could go in the docs (GitLab 14.10), the keys for changes have been previous and current. Besides, there is a draft change that we can use directly instead of guessing from the title.

I removed the [key: string] type declaration because the type of the value depends on the key of the change.

zecakeh commented 4 months ago

Woops, I had forgotten to push the commit :sweat_smile: