[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] TrackerRules: The Invert Actions doesn't save the correct Action that is...

"Joel Mpunga \(@joelmpunga79\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69f22569f21d3_3818f7b8267d@gitlab-sidekiq-low-urgency-cpu-bound-v2-646d8cfd6b-22vkb.mail>

Joel Mpunga pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
3df17e2f by Joel Mpunga at 2026-04-29T15:18:01+00:00
[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

- - - - -


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/3df17e2f3381315c1a08cc69526c9953c5ba6a38

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3df17e2f3381315c1a08cc69526c9953c5ba6a38
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.