Commit 6b7da6a4 authored by ShaunDychko's avatar ShaunDychko Committed by greggles

Issue #2911686 by ShaunDychko, nkoporec: Unsubscribe URL needs to be absolute

parent dc61cba1
......@@ -12,6 +12,7 @@ use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\field\Entity\FieldConfig;
use Drupal\node\Entity\NodeType;
......@@ -413,15 +414,18 @@ function comment_notify_mail($key, &$message, $params) {
* @param \Drupal\comment\CommentInterface $comment
* The subscribed comment object.
*
* @return \Drupal\Core\Url|null
* A Url object for the unsubscribe page, or NULL if the comment is missing a
* notification hash.
* @return string|null
* An absolute URL string for the unsubscribe page, or NULL if the comment is
* missing a notification hash.
*
* @todo In what case would a comment be missing its notification hash?
*/
function comment_notify_get_unsubscribe_url(CommentInterface $comment) {
if (!empty($comment->notify_hash)) {
return \Drupal::url('comment_notify.disable', ['hash' => $comment->notify_hash]);
return Url::fromRoute('comment_notify.disable', [
'hash' => $comment->notify_hash,
])->setAbsolute()
->toString();
}
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment