Skip to content

Add inapplicable reason in MR suggestion Tooltip

Samantha Ming requested to merge 219455-fe-inapplicable-tooltip-message into master

Issue: #219455 (closed)

MR Changes
!34149 (merged) BE Implementation
👉 (current) FE - Display Tooltip Message

What does this MR do?

In this previous MR, !33357 (merged), we displayed a generic message why the suggestion can not be applied. In this MR, we will display a more specific reason why the suggestion can not be applied. That inapplicable reason will be provided from the BE.

Testing Case

  1. Go to Merge Requests > "Changes" tab
  2. Comment on a line with code and click "insert suggestion" (docs)
  3. The tooltip will display the message from the BE for the following reason

Copy and paste from BE

BE Message Reason
You don't have write access to the source branch. when user has no write access to branch.
This merge request was merged. To apply this suggestion, edit this file directly. when MR was merged.
This merge request is closed. To apply this suggestion, edit this file directly. when MR is closed.
Can't apply as the source branch was deleted. when source branch is deleted.
Can't apply as this line was changed in a more recent version. when the line where suggestion is on is outdated.
Can't apply as these lines were changed in a more recent version. when lines where suggestion is on are outdated.
This suggestion already matches its content. when suggestion has the same content as the line it is on.
Can't apply this suggestion. default message when suggestion cannot be applied but doesn't fall into any of criteria above. We won't show this message anywhere right now but it makes sense to return something (e.g. when suggestion is already applied).

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #219455 (closed)

Edited by Samantha Ming

Merge request reports