[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][ENH][UX] Tracker: hide item notify switch when no user would be notified

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]> Mon, 20 Jul 2026 10:09:14 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a5df3ca5cfbb_38461ab807364c@gitlab-sidekiq-low-urgency-cpu-bound-v2-76655d7f68-sjj9k.mail>

ushindi bienvenu pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
15edc450 by Landry Bitege at 2026-07-20T10:00:48+00:00
[BP][ENH][UX] Tracker: hide item notify switch when no user would be notified
---
* [ENH][UX] Tracker: hide item notify switch when no user would be notified
---
* [FIX][UI] Tracker: hide item notify switch when no user would be notified

See merge request tikiwiki/tiki!10675

(cherry picked from commit 5f57124910478d506696150c3ad59f11950b5f26)

See merge request tikiwiki/tiki!10740

- - - - -


2 changed files:

- lib/core/Services/Tracker/Controller.php
- templates/tracker/update_item.tpl


Changes:

=====================================
lib/core/Services/Tracker/Controller.php
=====================================
@@ -1513,6 +1513,10 @@ class Services_Tracker_Controller
             }
         }
 
+        // Users who would be notified when saving, so the template can hide the notify switch when the list is empty
+        $trklib = TikiLib::lib('trk');
+        $notifyWatchers = $trklib->get_notification_emails($trackerId, $itemId, $trklib->get_tracker_options($trackerId));
+
         return [
             'title' => $title,
             'trackerId' => $trackerId,
@@ -1520,6 +1524,7 @@ class Services_Tracker_Controller
             'fields' => $displayedFields,
             'forced' => $forcedFields,
             'status' => $status,
+            'notifyWatchers' => $notifyWatchers,
             'skip_preview' => $input->skip_preview->word(),
             'skip_form' => $input->skip_form->word(),
             'skip_form_message' => $skip_form_message,


=====================================
templates/tracker/update_item.tpl
=====================================
@@ -34,17 +34,31 @@
     {else}
         <form method="post" action="{service controller=tracker action=update_item format=$format editItemPretty=$editItemPretty suppressFeedback=$suppressFeedback}" id="updateItemForm{$trackerId|escape}">
             {trackerfields trackerId=$trackerId fields=$fields status=$status itemId=$itemId format=$format editItemPretty=$editItemPretty}
-            <div class="form-check form-switch alert alert-warning mt-5">
-                <input type="checkbox"
-                    class="form-check-input tracker-notify-switch"
-                    id="notify_watchers"
-                    name="notify_watchers"
-                    value="1"
-                    checked>
-                <label class="form-check-label" for="notify_watchers">
-                    {tr}Notify users following this item{/tr}
-                </label>
-            </div>
+            {if not empty($notifyWatchers)}
+                <div class="form-check form-switch alert alert-warning mt-5">
+                    <input type="checkbox"
+                        class="form-check-input tracker-notify-switch"
+                        id="notify_watchers"
+                        name="notify_watchers"
+                        value="1"
+                        checked>
+                    <label class="form-check-label" for="notify_watchers">
+                        {tr}Notify users following this item{/tr}
+                    </label>
+                </div>
+                <div class="tracker-notify-watchers">
+                    {accordion}
+                        {* accordion_pos points at a non-existing group so this single group starts collapsed *}
+                        {accordion_group title="{tr}Users to notify{/tr} (`$notifyWatchers|@count`)" accordion_pos=2}
+                            <ul class="list-unstyled mb-0">
+                                {foreach from=$notifyWatchers item=watcher}
+                                    <li>{if not empty($watcher.user)}{$watcher.user|userlink}{else}{$watcher.email|escape}{/if}</li>
+                                {/foreach}
+                            </ul>
+                        {/accordion_group}
+                    {/accordion}
+                </div>
+            {/if}
             {if not empty($saveAndComment) and $saveAndComment neq 'n'}
                 <div class="form-check form-switch mb-4 mt-5">
                     <input type="checkbox" class="form-check-input" name="addComment" id="add-comment"/>
@@ -94,6 +108,15 @@
                     $(".comment-form").find("textarea").prop("disabled", true);
                 }
             });
+
+            {* Only show the list of users to notify while the notify switch is on *}
+            $("#notify_watchers").on("change", function() {
+                if ($(this).is(":checked")) {
+                    $(".tracker-notify-watchers").removeClass("d-none");
+                } else {
+                    $(".tracker-notify-watchers").addClass("d-none");
+                }
+            });
         {/jq}
     {/if}
 {/block}



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/15edc450140a244f85b90ad52495b6f59b2ce035

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/15edc450140a244f85b90ad52495b6f59b2ce035
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