I’ve created a pre-receive hook on the GitLab server to block any self-merge requests if the target branch is a protected branch. I managed to set a custom error message that displays in the GitLab UI using the “GL-HOOK-ERR” variable. The hook works perfectly, and the error message appears as expected when a user attempts a merge request.
However, the issue now is that the error message remains visible even after the page reloads, and it persists even if another user logs in to view the merge requests.
Do you have any ideas on how to make the custom message disappear after it’s displayed, so it only reappears if a user tries to merge again?
Can you provide me with a solution or some guidance?
Versions
Self-managed
GitLab Versions : 16.8.2-ee
Ruby Version: 3.1.4p223
Gem Version: 3.4.22
Gem Version: 3.4.22
Bundler Version:2.5.4
Redis Version: 7.0.15
Sidekiq Version:7.1.6
GitLab Shell:14.33.0