Skip to content

Commit

Permalink
Issue #503: Switch to '/node/1234'-style destination URLs in email
Browse files Browse the repository at this point in the history
to prevent broken links if the node's title changes.
  • Loading branch information
danhgov committed Jun 27, 2024
1 parent 7487abc commit 1b0690b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions html/modules/custom/bc_dc/src/Service/ReviewReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ public function generateBody(array $notifications): ?string {
$body[] = $update_message . ':';
foreach ($notifications[$update_type] as $update) {
// If a user clicks one of these links to one of
// their Metadata Recordsin the email they receive,
// their Metadata Records in the email they receive,
// they will confusingly get a "Not Found" error if they are not logged in.
// So we make the link to instead to the login page, with a REDIRECT
// to the real URL we want to take them to.
$url_via_login = Url::fromRoute('user.login', [], [
'query' => ['destination' => $update['dataset_url']],
'query' => ['destination' => '/node/' . $update['dataset_nid']],
'absolute' => TRUE,
]);
// GC Notify requires Markdown formatting, not HTML.
Expand Down Expand Up @@ -187,7 +187,7 @@ public function getReminders(): array {
if ($review_status) {
$reminders[$data_set->getOwnerId()][$review_status][] = [
'title' => $data_set->getTitle(),
'dataset_url' => $data_set->toUrl('canonical', ['absolute' => FALSE])->toString(),
'dataset_nid' => $data_set_nid,
];
}
}
Expand Down

0 comments on commit 1b0690b

Please sign in to comment.