Change http response code for missing-legalhold-consent.#1688
Conversation
412 is used for "need to add some clients" in message posting; 403 makes client implementations more straight-forward.
pcapriotti
left a comment
There was a problem hiding this comment.
Looks good, and it does make more sense to return 403 instead of 412. Minor suggestion below.
|
|
||
| missingLegalholdConsent :: Error | ||
| missingLegalholdConsent = mkError status412 "missing-legalhold-consent" "Failed to connect to a user or to invite a user to a group because somebody is under legalhold and somebody else has not granted consent." | ||
| missingLegalholdConsent = mkError status403 "missing-legalhold-consent" "Failed to connect to a user or to invite a user to a group because somebody is under legalhold and somebody else has not granted consent." |
There was a problem hiding this comment.
To avoid this duplication, you could turn this into an ErrorDescription and move it to the ErrorDescription module in wire-api, where it can then be used from both brig and galley. Also, it makes it easier to add it to swagger, if desired, or even later turn it into a statically checked response with MultiVerb.
I've done this for a bunch of errors as part of #1657. This is a typical example: 8e73769. It can be a bit of work though, depending on how often the error is thrown, so feel free to ignore this.
There was a problem hiding this comment.
thanks, i'll look into it.
There was a problem hiding this comment.
(why is nothing ever easy? :-))
There was a problem hiding this comment.
I've solved it like this: 83abb9c
I've made you the commit author @pcapriotti, let me know if that's not ok and I'll change it back.
There was a problem hiding this comment.
FYI: #1693 contains the change I was suggesting, since it was useful for another refactoring.
seems like i need to do some more integration test fixing... |
412 is used for "need to add some clients" in message posting; 403 makes client implementations more straight-forward.
It's probably worth mentioning that this only affects users about to get in contact with LH devices. For those users, we have a new safety check in place that if the user has old clients or is not in a team cleared for LH, she will get a new error response. 403 in that case is better, since it makes it clear to the client that this won't work on retry either. 412 is used for notifying the client that they need to pick up some newly added clients listening in on the conversation, so this will probably break in less nice ways.
tl;dr: only affects users in touch with LH teams that shouldn't, and makes their UX strictly better. :)
Checklist
make git-add-cassandra-schemato update the cassandra schema documentation.