From 194065e399db08ad827d00ad87e3393e469f7311 Mon Sep 17 00:00:00 2001 From: Sanjay Thiyagarajan Date: Thu, 24 Aug 2023 11:11:08 -0400 Subject: [PATCH 1/3] Fix for "othersWatching" history tracking --- SQL/0000-00-00-schema.sql | 2 +- modules/issue_tracker/php/edit.class.inc | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/SQL/0000-00-00-schema.sql b/SQL/0000-00-00-schema.sql index 32b6db9c374..143a5a85985 100644 --- a/SQL/0000-00-00-schema.sql +++ b/SQL/0000-00-00-schema.sql @@ -1531,7 +1531,7 @@ CREATE TABLE `issues_history` ( `issueHistoryID` int(11) unsigned NOT NULL AUTO_INCREMENT, `newValue` longtext NOT NULL, `dateAdded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID') NOT NULL DEFAULT 'comment', + `fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID', 'watching') NOT NULL DEFAULT 'comment', `issueID` int(11) unsigned NOT NULL, `addedBy` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`issueHistoryID`), diff --git a/modules/issue_tracker/php/edit.class.inc b/modules/issue_tracker/php/edit.class.inc index 73da2239e3d..94492d33d80 100644 --- a/modules/issue_tracker/php/edit.class.inc +++ b/modules/issue_tracker/php/edit.class.inc @@ -478,7 +478,15 @@ class Edit extends \NDB_Page implements ETagCalculator } // Get changed values to save in history - $historyValues = $this->getChangedValues($issueValues, $issueID, $user); + $issueValuesWithWatching = $issueValues; + if (isset($values['othersWatching'])) { + $usersWatching = implode(', ', $values['othersWatching']); + $issueValuesWithWatching['watching'] = $usersWatching; + } + $historyValues = $this->getChangedValues( + $issueValuesWithWatching, + $issueID, + $user); if (!empty($issueID)) { $db->update('issues', $issueValues, ['issueID' => $issueID]); From c4c520d23a451cc99349aa522a1b43dca8bd8e64 Mon Sep 17 00:00:00 2001 From: Sanjay Thiyagarajan Date: Thu, 24 Aug 2023 11:17:51 -0400 Subject: [PATCH 2/3] Fix formatting errors --- modules/issue_tracker/php/edit.class.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/issue_tracker/php/edit.class.inc b/modules/issue_tracker/php/edit.class.inc index 94492d33d80..ddeffe7b02d 100644 --- a/modules/issue_tracker/php/edit.class.inc +++ b/modules/issue_tracker/php/edit.class.inc @@ -480,13 +480,14 @@ class Edit extends \NDB_Page implements ETagCalculator // Get changed values to save in history $issueValuesWithWatching = $issueValues; if (isset($values['othersWatching'])) { - $usersWatching = implode(', ', $values['othersWatching']); + $usersWatching = $values['othersWatching']; $issueValuesWithWatching['watching'] = $usersWatching; } $historyValues = $this->getChangedValues( $issueValuesWithWatching, $issueID, - $user); + $user + ); if (!empty($issueID)) { $db->update('issues', $issueValues, ['issueID' => $issueID]); From c1452248861b4692252e6a0a84d6acbbc433b8b0 Mon Sep 17 00:00:00 2001 From: Sanjay Thiyagarajan Date: Fri, 25 Aug 2023 20:32:22 +0530 Subject: [PATCH 3/3] Update SQL/0000-00-00-schema.sql Co-authored-by: racostas <37309344+racostas@users.noreply.github.com> --- SQL/0000-00-00-schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQL/0000-00-00-schema.sql b/SQL/0000-00-00-schema.sql index 143a5a85985..1d7c5bd681b 100644 --- a/SQL/0000-00-00-schema.sql +++ b/SQL/0000-00-00-schema.sql @@ -1531,7 +1531,7 @@ CREATE TABLE `issues_history` ( `issueHistoryID` int(11) unsigned NOT NULL AUTO_INCREMENT, `newValue` longtext NOT NULL, `dateAdded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID', 'watching') NOT NULL DEFAULT 'comment', + `fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID','watching') NOT NULL DEFAULT 'comment', `issueID` int(11) unsigned NOT NULL, `addedBy` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`issueHistoryID`),