mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-22 16:51:56 +02:00
[ticket/12371] Allow notification types to redirect to a different url
This way we can redirect the post and bookmark notification to the first unread post in the topic PHPBB3-12371
This commit is contained in:
parent
ed40846590
commit
e0fadfb4d6
phpBB
@ -63,7 +63,7 @@ if (($mark_notification = $request->variable('mark_notification', 0)))
|
||||
redirect(append_sid($phpbb_root_path . $redirect));
|
||||
}
|
||||
|
||||
redirect($notification->get_url());
|
||||
redirect($notification->get_redirect_url());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,6 +275,14 @@ abstract class base implements \phpbb\notification\type\type_interface
|
||||
return $this->mark(true, $return);
|
||||
}
|
||||
|
||||
/**
|
||||
* {inheritDoc}
|
||||
*/
|
||||
public function get_redirect_url()
|
||||
{
|
||||
return $this->get_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare to output the notification to the template
|
||||
*
|
||||
|
@ -269,6 +269,14 @@ class post extends \phpbb\notification\type\base
|
||||
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}");
|
||||
}
|
||||
|
||||
/**
|
||||
* {inheritDoc}
|
||||
*/
|
||||
public function get_redirect_url()
|
||||
{
|
||||
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_parent_id}&view=unread#unread");
|
||||
}
|
||||
|
||||
/**
|
||||
* Users needed to query before this notification can be displayed
|
||||
*
|
||||
|
@ -98,6 +98,13 @@ interface type_interface
|
||||
*/
|
||||
public function get_url();
|
||||
|
||||
/**
|
||||
* Get the url to redirect after the item has been marked as read
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
public function get_redirect_url();
|
||||
|
||||
/**
|
||||
* URL to unsubscribe to this notification
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user