[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][FIX] TrackerRules: The Invert Actions doesn't save the correct Action...
"Joel Mpunga \(@joelmpunga79\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69f3343e864a5_3818fa4c908d0@gitlab-sidekiq-low-urgency-cpu-bound-v2-bd5c9fdf6-w6t6k.mail> |
Joel Mpunga pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki Commits: 5769abb6 by Joel Mpunga at 2026-04-30T10:42:42+00:00 [BP][FIX] TrackerRules: The Invert Actions doesn't save the correct Action that is supposed to be the opposite of Else --- * [FIX] TrackerRules: The Invert Actions doesn't save the correct Action that is that is supposed to be the opposite of Else --- * [FIX] TrackerRules: The Invert Actions doesn't save the correct Action that is supposed to be the opposite of Else See merge request tikiwiki/tiki!10025 (cherry picked from commit 3df17e2f3381315c1a08cc69526c9953c5ba6a38) c7b26bdf [FIX] TrackerRules: The Invert Actions doesn't save the correct Action that is... Co-authored-by: Joel Mpunga <[email protected]> See merge request tikiwiki/tiki!10114 - - - - - 1 changed file: - src/js/vue-mf/tracker-rules/src/components/TrackerRules.vue Changes: ===================================== src/js/vue-mf/tracker-rules/src/components/TrackerRules.vue ===================================== @@ -275,30 +275,23 @@ const handleInvertActions = () => { return ; // no valid actions } - // Shallow clone the actions and set them to the opposites - const oppositeActions = { ...actions }; + const invertedOperators = { + Show: "Hide", + Hide: "Show", + Editable: "NotEditable", + NotEditable: "Editable", + Required: "NotRequired", + NotRequired: "Required", + }; + + // Clone deeply so inverting Else never mutates Actions source data. + // Some runtimes do not expose structuredClone yet. + const oppositeActions = JSON.parse(JSON.stringify(actions)); // Invert operator IDs oppositeActions.predicates.forEach((pred) => { - switch (pred.operator_id) { - case "Show": - pred.operator_id = "Hide"; - break; - case "Hide": - pred.operator_id = "Show"; - break; - case "Editable": - pred.operator_id = "NotEditable"; - break; - case "NotEditable": - pred.operator_id = "Editable"; - break; - case "Required": - pred.operator_id = "NotRequired"; - break; - case "NotRequired": - pred.operator_id = "Required"; - break; + if (invertedOperators[pred.operator_id]) { + pred.operator_id = invertedOperators[pred.operator_id]; } }); View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5769abb6c192c7e38b72f3e0c8821dda9164330d -- View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5769abb6c192c7e38b72f3e0c8821dda9164330d You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help _______________________________________________ TikiWiki-cvs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs