Skip to content

Scope type: switch conditions in wrong order for enabled filter #114

Description

@Rike-cz

In plugins/rainlab/location/models/country/scopes.yaml, the conditions array for the enabled switch scope is reversed:

enabled:
    label: Enabled
    type: switch
    conditions:
        - is_enabled = '1'   # applied when switch is OFF (indeterminate)
        - is_enabled = '0'   # applied when switch is ON (checked)

According to the switch scope documentation, the first condition applies to the indeterminate (off) state and the second to the checked (on) state. The current order causes the filter to show disabled countries when the switch is turned on, and enabled countries when it is turned off.


Footnote - wouldn't it actually be better if it went ON on the first click and OFF on the second? But it's a huge breaking change...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions