@bx80 opened this Pull Request on November 23rd 2021 Contributor

Description:

Fixes #18332

Adds an option to specify the max allowed period for transitions, either globally or per site

[Transitions]
max_period_allowed = "month"
[Transitions_1]
max_period_allowed = "week"

Site level settings override the general settings.
All period smaller than the max period are allowed, so month will also allow week and day.
Ranges with more days than the max period will not be allowed, eg. an 8 day range isn't allowed if the max_period_allowed = "week", but a 7 day range would be ok.

Row transitions obey the same rules, but I haven't hidden the row transition action icon if the period is not allowed as it might be confusing to have to icon disappear entirely without any explanation. It's also a bit awkward having the datatable row action registration methods make an async API call each time to check period availability - open to suggestions on how to do this efficiently if we really want to go ahead and hide the row action :slightly_smiling_face:

Review

@bx80 commented on November 24th 2021 Contributor

@sgiehl Thanks, Template.jsGlobalVariables was the pointer I needed. I've added code to disable the transitions row action if the period isn't allowed. Also added a system test to make sure the config setting results in the correct exception.

This Pull Request was closed on December 1st 2021
Powered by GitHub Issue Mirror