Fix display of CLI broadcast messages with user target roles
What does this MR do and why?
Broadcast messages with "Target roles" were not displayed on the CLI.
Why?
The user_access_level
was always passed in as nil
into the finder.
So any broadcast message with a non-empty target_access_levels
checked
if one of its allowed levels was nil
, which was always false.
See https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/system/broadcast_message.rb#L141
References
Related to #497152 (closed)
Screenshots or screen recordings
CLI change only. See instructions below.
How to set up and validate locally
- Create a new message at http://gdk.test:3000/admin/broadcast_messages
- Make it of type banner.
- Keep the displays on CLI checkbox enabled.
- Leave the target roles empty for now.
-
git clone
any project from your GDK. -
git push
a change (orgit pull
after creating a commit in the browser). - This should display your messages, both on `master and this branch.
- Now edit the same broadcast message and set its target roles to include your role in the project.
- Now, on
master
doing anothergit push
won't show the message🐛
You can also verify, that if there is a newer (created_at
) message, with or without target roles, that one shows instead. See https://docs.gitlab.com/ee/administration/broadcast_messages.html#banners
In the command line, only the latest banner is shown.
Edited by Thomas Hutterer