[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Tracker: allow users to skip email notifications when updating items

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6914c6628e8f7_2ce301c55122@gitlab-sidekiq-low-urgency-cpu-bound-v2-77d988696-lvn8b.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
9bc4229a by Landry Bitege at 2025-11-12T17:31:37+00:00
[ENH] Tracker: allow users to skip email notifications when updating items
---
* [ENH] Tracker: allow users to skip email notifications when updating items

See merge request tikiwiki/tiki!8778

- - - - -


5 changed files:

- lib/core/Services/Tracker/Controller.php
- lib/core/Services/Tracker/Utilities.php
- lib/trackers/trackerlib.php
- templates/tracker/update_item.tpl
- themes/base_files/scss/_tiki-trackers.scss


Changes:

=====================================
lib/core/Services/Tracker/Controller.php
=====================================
@@ -1393,6 +1393,7 @@ class Services_Tracker_Controller
                     'processedFields' => $processedFields,
                     'deletedFiles' => $deletedFiles,
                     'validate' => $validate,
+                    'notify_watchers' => $input->notify_watchers->word(),
                 ]
             );
 


=====================================
lib/core/Services/Tracker/Utilities.php
=====================================
@@ -26,7 +26,8 @@ class Services_Tracker_Utilities
             'skip_categories' => false,
             'bulk_import' => $item['bulk_import'] ?? false,
             'skip_sync' => $item['skip_sync'] ?? false,
-            'deleted_files' => $item['deletedFiles'] ?? []
+            'deleted_files' => $item['deletedFiles'] ?? [],
+            'notify_watchers' => $item['notify_watchers']
         ]);
     }
 
@@ -109,7 +110,7 @@ class Services_Tracker_Utilities
         }
 
         if (! $options['validate'] || count($errors) == 0) {
-            $newItem = $trklib->replace_item($trackerId, $itemId, ['data' => $fields], $status, 0, $options['bulk_import'], $options['skip_sync'], $options['deleted_files'] ?? []);
+            $newItem = $trklib->replace_item($trackerId, $itemId, ['data' => $fields], $status, 0, $options['bulk_import'], $options['skip_sync'], $options['deleted_files'] ?? [], $options['notify_watchers']);
             return $newItem;
         }
 


=====================================
lib/trackers/trackerlib.php
=====================================
@@ -1978,7 +1978,7 @@ class TrackerLib extends TikiLib
         $_GET = $get;
     }
 
-    public function replace_item($trackerId, $itemId, $ins_fields, $status = '', $ins_categs = 0, $bulk_import = false, $skip_sync = false, $deleted_files = [])
+    public function replace_item($trackerId, $itemId, $ins_fields, $status = '', $ins_categs = 0, $bulk_import = false, $skip_sync = false, $deleted_files = [], $notify_watchers = true)
     {
         global $user, $prefs, $tiki_p_admin_trackers, $tiki_p_admin_users;
         $final_event = 'tiki.trackeritem.update';
@@ -2349,6 +2349,7 @@ class TrackerLib extends TikiLib
             'bulk_import' => $bulk_import,
             'skip_sync' => $skip_sync,
             'aggregate' => sha1("trackeritem/$currentItemId"),
+            'notify_watchers' => $notify_watchers,
         ];
 
         // this needs to trigger no matter of the size as trackeritem categorization depends on this and other event types as well
@@ -5594,6 +5595,10 @@ class TrackerLib extends TikiLib
             return;
         }
 
+        if (! $args['notify_watchers']) {
+            return;
+        }
+
         $trackerId = $args['trackerId'];
         $itemId = $args['object'];
 


=====================================
templates/tracker/update_item.tpl
=====================================
@@ -34,6 +34,18 @@
     {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}
+            <hr>
+            <div class="form-check form-switch alert alert-warning">
+                <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="submit">
                 {if $skip_preview neq 'y'}
                     <input type="button" class="btn btn-secondary previewItemBtn" title="{tr}Preview your changes.{/tr}" name="preview" value="{tr}Preview{/tr}">


=====================================
themes/base_files/scss/_tiki-trackers.scss
=====================================
@@ -197,6 +197,11 @@
     }
 }
 
+.form-switch .form-check-input.tracker-notify-switch {
+  margin-left: 0;
+  margin-right: 0.5em;
+}
+
 // vue.js field conditions defs
 
 .tracker-rules .actions .ui-predicate__row:first-child,



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9bc4229a7989af4583b865fbf6f156f92bb199d7

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9bc4229a7989af4583b865fbf6f156f92bb199d7
You're receiving this email because of your account on gitlab.com.

_______________________________________________
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.