mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11103] Fixing some bugs with the post/topic notifications
PHPBB3-11103
This commit is contained in:
parent
3897a442f7
commit
aa3f6f4002
3 changed files with 21 additions and 32 deletions
|
@ -2221,41 +2221,32 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
|
|
||||||
// Send Notifications
|
// Send Notifications
|
||||||
$phpbb_notifications = $phpbb_container->get('notifications');
|
$phpbb_notifications = $phpbb_container->get('notifications');
|
||||||
|
$notification_data = array_merge($data, array(
|
||||||
|
'topic_title' => (isset($data['topic_title'])) ? $data['topic_title'] : $subject,
|
||||||
|
'post_username' => $username,
|
||||||
|
'poster_id' => $poster_id,
|
||||||
|
'post_text' => $data['message'],
|
||||||
|
'post_time' => $current_time,
|
||||||
|
'post_subject' => $subject,
|
||||||
|
));
|
||||||
if ($post_approval)
|
if ($post_approval)
|
||||||
{
|
{
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'post' :
|
case 'post' :
|
||||||
$phpbb_notifications->add_notifications(array('topic', 'quote'), array_merge($data, array(
|
$phpbb_notifications->add_notifications(array('topic', 'quote'), $notification_data);
|
||||||
'post_username' => $username,
|
|
||||||
'poster_id' => (int) $user->data['user_id'],
|
|
||||||
'post_time' => $current_time,
|
|
||||||
)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'reply' :
|
case 'reply' :
|
||||||
case 'quote' :
|
case 'quote' :
|
||||||
$phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), array_merge($data, array(
|
$phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), $notification_data);
|
||||||
'post_username' => $username,
|
|
||||||
'poster_id' => (int) $user->data['user_id'],
|
|
||||||
'post_text' => $data['message'],
|
|
||||||
'post_time' => $current_time,
|
|
||||||
)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'edit_topic' :
|
case 'edit_topic' :
|
||||||
case 'edit_first_post' :
|
case 'edit_first_post' :
|
||||||
case 'edit' :
|
case 'edit' :
|
||||||
case 'edit_last_post' :
|
case 'edit_last_post' :
|
||||||
$phpbb_notifications->update_notifications('topic', array_merge($data, array(
|
$phpbb_notifications->update_notifications(array('quote', 'bookmark', 'topic', 'post'), $notification_data);
|
||||||
'post_username' => $username,
|
|
||||||
'topic_title' => $subject,
|
|
||||||
)));
|
|
||||||
|
|
||||||
$phpbb_notifications->update_notifications(array('quote', 'bookmark', 'post'), array_merge($data, array(
|
|
||||||
'post_username' => $username,
|
|
||||||
'post_text' => $data['message'],
|
|
||||||
)));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2264,20 +2255,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'post' :
|
case 'post' :
|
||||||
$phpbb_notifications->add_notifications(array('topic_in_queue'), array_merge($data, array(
|
$phpbb_notifications->add_notifications(array('topic_in_queue'), $notification_data);
|
||||||
'post_username' => $username,
|
|
||||||
'poster_id' => (int) $user->data['user_id'],
|
|
||||||
'post_time' => $current_time,
|
|
||||||
)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'reply' :
|
case 'reply' :
|
||||||
case 'quote' :
|
case 'quote' :
|
||||||
$phpbb_notifications->add_notifications(array('post_in_queue'), array_merge($data, array(
|
$phpbb_notifications->add_notifications(array('post_in_queue'), $notification_data);
|
||||||
'post_username' => $username,
|
|
||||||
'poster_id' => (int) $user->data['user_id'],
|
|
||||||
'post_time' => $current_time,
|
|
||||||
)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'edit_topic' :
|
case 'edit_topic' :
|
||||||
|
|
|
@ -37,7 +37,7 @@ class phpbb_notifications_type_quote extends phpbb_notifications_type_post
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected static $regular_expression_match = '#\[quote="(.+?)":#';
|
protected static $regular_expression_match = '#\[quote="(.+?)"#';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language key used to output the text
|
* Language key used to output the text
|
||||||
|
@ -155,6 +155,12 @@ class phpbb_notifications_type_quote extends phpbb_notifications_type_post
|
||||||
$add_notifications[$user_id] = $notifications[$user_id];
|
$add_notifications[$user_id] = $notifications[$user_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo Adding notifications while editing a post can be funky.
|
||||||
|
// If the user has read the topic/post already, and the user is newly quoted it an edit,
|
||||||
|
// The notification will be stuck as unread until another post is made and the user visits
|
||||||
|
// the topic again because the posts will not be marked as read since the topic is already
|
||||||
|
// marked as read
|
||||||
|
|
||||||
// Add the necessary notifications
|
// Add the necessary notifications
|
||||||
$service->add_notifications_for_users(self::get_item_type(), $post, $add_notifications);
|
$service->add_notifications_for_users(self::get_item_type(), $post, $add_notifications);
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base
|
||||||
|
|
||||||
$this->set_data('topic_title', $post['topic_title']);
|
$this->set_data('topic_title', $post['topic_title']);
|
||||||
|
|
||||||
$this->set_data('post_username', (($post['post_username'] != $this->phpbb_container->get('user')->data['username']) ? $post['post_username'] : ''));
|
$this->set_data('post_username', (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : ''));
|
||||||
|
|
||||||
$this->set_data('forum_name', $post['forum_name']);
|
$this->set_data('forum_name', $post['forum_name']);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue