[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Wrong feedback on wiki page monitoring destinations

"Adrien Mbuya Maloba \(@adrienmaloba\) via TikiWiki-cvs" <[email protected]> Fri, 17 Jul 2026 14:20:36 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a5a3a34e8c89_3919cf943803f@gitlab-sidekiq-low-urgency-cpu-bound-v2-5557f4879d-c9k4v.mail>

Adrien Mbuya Maloba pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
4ece0da6 by Landry Bitege at 2026-07-17T17:02:40+03:00
[FIX] Wrong feedback on wiki page monitoring destinations
---
* [FIX] Feedback: exclude editor from 'Notification sent to' list when self-notification is disabled

* [FIX] Wiki page edit: stop unwatching users on page save

See merge request tikiwiki/tiki!10659

- - - - -


2 changed files:

- lib/core/Feedback.php
- tiki-editpage.php


Changes:

=====================================
lib/core/Feedback.php
=====================================
@@ -466,7 +466,7 @@ class Feedback
      */
     public static function showWatchers(string $watch_event, $object, $extra_event = null)
     {
-        global $prefs;
+        global $prefs, $user;
         if ($prefs['feature_user_watches'] === 'y') {
             $watches = TikiLib::lib('tiki')->get_event_watches($watch_event, $object);
 
@@ -479,6 +479,15 @@ class Feedback
                 $watches = array_merge($watches, $extra_watches);
             }
 
+            // The editor is silently excluded from wiki_page_changed notifications unless they
+            // explicitly opted in (see sendWikiEmailNotification in notificationemaillib.php),
+            // so the displayed list must reflect the same exclusion.
+            if ($watch_event === 'wiki_page_changed' && ($prefs['wiki_watch_editor'] != 'y' || $prefs['user_wiki_watch_editor'] != 'y')) {
+                $watches = array_values(array_filter($watches, function ($watch) use ($user) {
+                    return $watch['user'] !== $user;
+                }));
+            }
+
             if (count($watches)) {
                 $usersList = [];
                 foreach ($watches as $watch) {


=====================================
tiki-editpage.php
=====================================
@@ -328,24 +328,8 @@ if (isset($_REQUEST['minor'])) {
     $_REQUEST['save'] = true;
 }
 
-if ($user && $prefs['feature_user_watches'] === 'y') {
-    $isFormSubmit = isset($jitRequest['edit']);
-    if ($tikilib->page_exists($page)) {
-        $currentlyWatching = (bool) $tikilib->user_watches($user, 'wiki_page_changed', $page, 'wiki page');
-        $default = $currentlyWatching;
-    } else {
-        // New pages get default watch checked for authors
-        $currentlyWatching = false;
-        $default = ($prefs['wiki_watch_author'] === 'y');
-    }
-
-    $requestedWatch = isset($_REQUEST['watch']) && $isFormSubmit;
-    $smarty->assign('show_watch', 'y');
-    $smarty->assign('watch_checked', ( ($default && ! $isFormSubmit) || $requestedWatch) ? 'y' : 'n');
-} else {
-    $currentlyWatching = false;
-    $requestedWatch = false;
-    $smarty->assign('show_watch_controls', 'n');
+if (! $tikilib->page_exists($page) && $user && $prefs['feature_user_watches'] === 'y' && $prefs['wiki_watch_author'] === 'y') {
+    $tikilib->add_user_watch($user, 'wiki_page_changed', $page, 'wiki page', $page, $wikilib->sefurl($page));
 }
 
 if (isset($_REQUEST['partial_save'])) {
@@ -544,15 +528,6 @@ if (isset($_FILES['userfile1']) && is_uploaded_file($_FILES['userfile1']['tmp_na
         }
     }
 
-    // If the watch state is not the same
-    if ($requestedWatch !== $currentlyWatching) {
-        if ($requestedWatch) {
-            $tikilib->add_user_watch($user, 'wiki_page_changed', $page, 'wiki page', $page, $wikilib->sefurl($page));
-        } else {
-            $tikilib->remove_user_watch($user, 'wiki_page_changed', $page, 'wiki page');
-        }
-    }
-
     if (isset($_REQUEST["save"])) {                 // jb tiki 6 - this block of code seems to be redundant and unused - TOKIL
         unset($_REQUEST["save"]);
         if ($page_ref_id) {
@@ -1417,15 +1392,6 @@ if (
         }
         /* Local reference handling */
 
-        // If the watch state is not the same
-        if ($requestedWatch !== $currentlyWatching) {
-            if ($requestedWatch) {
-                $tikilib->add_user_watch($user, 'wiki_page_changed', $page, 'wiki page', $page, $wikilib->sefurl($page));
-            } else {
-                $tikilib->remove_user_watch($user, 'wiki_page_changed', $page, 'wiki page');
-            }
-        }
-
         if (! empty($prefs['geo_locate_wiki']) && $prefs['geo_locate_wiki'] == 'y' && ! empty($_REQUEST['geolocation'])) {
             TikiLib::lib('geo')->set_coordinates('wiki page', $page, $_REQUEST['geolocation']);
         }



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/4ece0da6cbec9f2fc13cbd95b94a8a531ea79813

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