Automatically hide newly created fields on views that are shared publicly
Picture the situation:
- We have 2 views: Grid View A and Grid View B.
- In Grid view A we create a Text field with content "Internal information". We hide this field, because the info is internal.
- Then we make Grid View B public. The field with "Internal information" is not visible publicly (as it is supposed to be).
- Then in the Grid view A we create another Text field (just an example) with different "Internal information vol. 2".
- This new field with "Internal information vol. 2" created at Grid View A will be visible at the publicly shared view for Grid View B.
We don't want this to happen, because we might expose sensitive information when creating new fields when doing so. What should happen, is: when creating a new field, if at least a single field is hidden for any view within a table (it can be any view: Grid, Kanban etc.), we should automatically hide this newly created field.
Intro
Newly created fields should be hidden in views if the view is publicly shared.
Every view has a thorough table where it stores field-specific properties for that view. This table can contain the width of the field in the grid view and its hidden/visible state. Every view can have a different default hidden/visible state for a new field.
Functional requirements
- Note that a field is not necessarily created in a view. This can also happen via the API.
- If a new field is created:
- If the view is publicly shared or the default hidden value for the view type is true, then the hidden property for the field option should be set to true.
- Otherwise (the view is not publicly shared and the default value for the view type is to be visible), the hidden property can be set to false.
Technical requirements
- This must be done with the least number of queries possible.
- Keep in mind that a table can have hundreds of views, so the code must work efficiently.