Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue tracker] Fix emailing bug found in HBCD #8300

Merged
merged 5 commits into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 11 additions & 12 deletions modules/issue_tracker/php/edit.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class Edit extends \NDB_Page implements ETagCalculator
$db->replace('issues_watching', $nowWatching);

// sending email
$this->emailUser($issueID, $issueValues['assignee'], $user);
$this->emailUser($issueID, $issueValues['assignee'], '', $user);
}

// Adding others from multiselect to watching table.
Expand Down Expand Up @@ -519,7 +519,7 @@ class Edit extends \NDB_Page implements ETagCalculator
) {
continue;
}
$this->emailUser($issueID, $usersWatching, $user);
$this->emailUser($issueID, '', $usersWatching, $user);
}
}
}
Expand Down Expand Up @@ -550,12 +550,14 @@ class Edit extends \NDB_Page implements ETagCalculator
*
* @param int $issueID the issueID
* @param string $changed_assignee changed assignee
* @param string $changed_watcher changed watcher
* @param \User $user the user requesting the change
*
* @return void
*/
function emailUser(int $issueID, string $changed_assignee, \User $user)
{
function emailUser(int $issueID, string $changed_assignee,
string $changed_watcher, \User $user
) {
$db = $this->loris->getDatabaseConnection();
$baseurl = \NDB_Factory::singleton()->settings()->getBaseURL();

Expand Down Expand Up @@ -597,9 +599,6 @@ class Edit extends \NDB_Page implements ETagCalculator
$msg_data
);
}
} else {
// so query below doesn't break..
$changed_assignee = $user->getUsername();
}

$issue_change_emails = $db->pselect(
Expand All @@ -611,12 +610,12 @@ class Edit extends \NDB_Page implements ETagCalculator
INNER JOIN issues_watching w ON (w.userID = u.UserID)
WHERE
w.issueID = :issueID
AND w.userID = :uid
AND u.UserID = :assignee",
AND u.UserID = :watcher
AND u.UserID != :currentUser",
[
'issueID' => $issueID,
'uid' => $user->getUsername(),
'assignee' => $changed_assignee,
'issueID' => $issueID,
'watcher' => $changed_watcher,
'currentUser' => $user->getUserName(),
]
);

Expand Down