danger / swift

⚠️ Stop saying "you forgot to …" in code review
https://danger.systems/swift/
MIT License
1.04k stars 135 forks source link

Fix decoding error for gitlab user #601

Open gokberkince opened 6 months ago

gokberkince commented 6 months ago

Problem

In some cases in which the LDAP user is blocked from Gitlab, danger gives a decoding error because that state is unsatisfied.

Example User Response:

{ "id": XXX, "username": "xxx.xxx", "name": "XXX XXX", "state": "ldap_blocked", "avatar_url": "https://secure.gravatar.com/avatar/{avatar.id}?s=80&d=identicon", "web_url": "https://gitlab.example.com/xxx.xxx" }

Example Curl:

curl --location 'https://gitlab.example.com/api/v4/projects/{projectId}/merge_requests/{mergeRequestId}' \ --header 'Content-Type: application/json' \ --header 'PRIVATE-TOKEN: {TOKEN}'

Solution

Added a case to the user's 'state' enum to decode that state correctly.

case ldapBlocked = "ldap_blocked"