Improve UI error message when SSH key is expired
Proposal
The code written in the below discussion is displaying error messages by switching on strings which is a strong code smell.
We should refactor this to make proper use of Rails validations at the model level rather than displaying errors based on the existance of other errors by comparing strings. Context is in the discussion linked below
The following discussion from !57494 (merged) should be addressed:
-
@rob.hunt started a discussion: (+3 comments) Note: I couldn't think of a better way to do this
🤔 . The key model currently outputs an error when we are enforcing and the key has expired. This is to show an error when a user tries to use the key itself (git operations).However, we want to display a different message in the UI in this instance where a key has expired, expiry is enforced and the key is valid (apart from the expiry invalidation). So I am removing the specific error message and checking to see if any others exist, if so show one message, otherwise default to the other
/cc @mwoolf as this may be the wrong way to do this
🙈