Skip to content

Ensure ApplicationSetting#performance_bar_allowed_group_id is properly set when retrieved from cache

Rémy Coutable requested to merge 46758-fallout-of-cacheable-attribute into master

What does this MR do?

This removes the custom setters #performance_bar_allowed_group_id= and #performance_bar_enabled= from ApplicationSetting since that was creating issues now that we cache the attributes as JSON in Redis.

I think moving the "casting" from the model to the service layer is the right move, since the model shouldn't care that the UI/API accept a group path instead of a group ID.

I've also taken the opportunity to add comprehensive tests and that allowed me to simplify the logic a lot.

Are there points in the code the reviewer needs to double check?

I don't think so, the controller and the API are using the UpdateService so we're good.

Why was this MR needed?

Because since we had a custom #performance_bar_allowed_group_id= setter, we tried to find the allowed group with find_by_full_path but in that case performance_bar_allowed_group_id was already a group ID, not a group path!

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Fixes #46758 (closed).

Edited by Rémy Coutable

Merge request reports

Loading