Add hidden attribute in merge_requests index
What does this MR do and why?
This MR will add a boolean field hidden in the MergeRequest ES mapping. The value of hidden will be true if the author of the MR is banned and the value will be false if the author of the MR is unbanned. This field can be used to filter out the hidden MRs in the search results. This is a reference MR done to fix the issues:
Screenshots or screen recordings
How to set up and validate locally
- Run local development
gdk start
- Run the elasticsearch migration
gitlab:elastic:index
- Run the ES
_searchquery and make sure thehiddenattribute is present
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-merge_requests/_search' | json_pp
- Now ban an author of an issue, and run the
_searchquery again. Set the author_id to the banned user_id.
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-merge_requests/_search' -d '{ "query": { "term": { "author_id": 47 } } }' | json_pp
- Make sure the
hiddenattribute value istrue. You might have to wait for a few seconds to finish the Sidekiq - Now unban the user and run the same query
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-merge_requests/_search' -d '{ "query": { "term": { "author_id": 47 } } }' | json_pp
- Make sure the
hiddenattribute value isfalse. You might have to wait for a few seconds to finish the Sidekiq job Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #394746
Edited by Ravi Kumar
