mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/11103] Update notifications on post/topic edit
PHPBB3-11103
This commit is contained in:
parent
3624d2c50a
commit
e09f25d597
4 changed files with 34 additions and 13 deletions
|
@ -2220,12 +2220,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send Notifications
|
// Send Notifications
|
||||||
if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval)
|
if ($post_approval)
|
||||||
{
|
{
|
||||||
$notifications = $phpbb_container->get('notifications');
|
$notifications = $phpbb_container->get('notifications');
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
|
case 'post' :
|
||||||
|
$notifications->add_notifications('topic', array_merge($data, array(
|
||||||
|
'post_username' => $username,
|
||||||
|
)));
|
||||||
|
break;
|
||||||
|
|
||||||
case 'reply' :
|
case 'reply' :
|
||||||
case 'quote' :
|
case 'quote' :
|
||||||
$notifications->add_notifications('post', array_merge($data, array(
|
$notifications->add_notifications('post', array_merge($data, array(
|
||||||
|
@ -2233,8 +2239,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
)));
|
)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'post' :
|
case 'edit_topic' :
|
||||||
$notifications->add_notifications('topic', array_merge($data, array(
|
case 'edit_first_post' :
|
||||||
|
case 'edit' :
|
||||||
|
case 'edit_last_post' :
|
||||||
|
$notifications->update_notifications('topic', array_merge($data, array(
|
||||||
|
'post_username' => $username,
|
||||||
|
'topic_title' => $subject,
|
||||||
|
)));
|
||||||
|
$notifications->update_notifications('post', array_merge($data, array(
|
||||||
'post_username' => $username,
|
'post_username' => $username,
|
||||||
)));
|
)));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -58,10 +58,10 @@ class phpbb_notifications_service
|
||||||
// Merge default options
|
// Merge default options
|
||||||
$options = array_merge(array(
|
$options = array_merge(array(
|
||||||
'user_id' => $user->data['user_id'],
|
'user_id' => $user->data['user_id'],
|
||||||
'limit' => 5,
|
|
||||||
'start' => 0,
|
|
||||||
'order_by' => 'time',
|
'order_by' => 'time',
|
||||||
'order_dir' => 'DESC',
|
'order_dir' => 'DESC',
|
||||||
|
'limit' => 5,
|
||||||
|
'start' => 0,
|
||||||
), $options);
|
), $options);
|
||||||
|
|
||||||
$notifications = $user_ids = array();
|
$notifications = $user_ids = array();
|
||||||
|
@ -147,7 +147,7 @@ class phpbb_notifications_service
|
||||||
foreach ($methods as $method)
|
foreach ($methods as $method)
|
||||||
{
|
{
|
||||||
// setup the notification methods and add the notification to the queue
|
// setup the notification methods and add the notification to the queue
|
||||||
if ($method)
|
if ($method) // blank means we just insert it as a notification, but do not notify them by any other means
|
||||||
{
|
{
|
||||||
if (!isset($notification_methods[$method]))
|
if (!isset($notification_methods[$method]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,11 @@ class phpbb_notifications_type_post extends phpbb_notifications_type_base
|
||||||
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->phpbb_container->get('user')->lang('NOTIFICATION_POST', $username, censor_text($this->get_data('topic_title')));
|
return $this->phpbb_container->get('user')->lang(
|
||||||
|
'NOTIFICATION_POST',
|
||||||
|
$username,
|
||||||
|
censor_text($this->get_data('topic_title'))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +121,11 @@ class phpbb_notifications_type_post extends phpbb_notifications_type_base
|
||||||
$username = $user_data['username'];
|
$username = $user_data['username'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->phpbb_container->get('user')->lang('NOTIFICATION_POST', $username, censor_text($this->get_data('topic_title')));
|
return $this->phpbb_container->get('user')->lang(
|
||||||
|
'NOTIFICATION_POST',
|
||||||
|
$username,
|
||||||
|
censor_text($this->get_data('topic_title'))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,7 +174,7 @@ class phpbb_notifications_type_post 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->set_data('post_username', (($post['post_username'] != $this->phpbb_container->get('user')->data['username']) ? $post['post_username'] : ''));
|
||||||
|
|
||||||
$this->set_data('forum_name', $post['forum_name']);
|
$this->set_data('forum_name', $post['forum_name']);
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base
|
||||||
*/
|
*/
|
||||||
public function get_url()
|
public function get_url()
|
||||||
{
|
{
|
||||||
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t{$this->item_id}");
|
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,7 +147,7 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base
|
||||||
*/
|
*/
|
||||||
public function get_full_url()
|
public function get_full_url()
|
||||||
{
|
{
|
||||||
return generate_board_url() . "/viewtopic.{$this->php_ext}?t{$this->item_id}";
|
return generate_board_url() . "/viewtopic.{$this->php_ext}?t={$this->item_id}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,13 +170,13 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base
|
||||||
*/
|
*/
|
||||||
public function create_insert_array($post)
|
public function create_insert_array($post)
|
||||||
{
|
{
|
||||||
$this->item_id = $post['post_id'];
|
$this->item_id = $post['topic_id'];
|
||||||
|
|
||||||
$this->set_data('poster_id', $post['poster_id']);
|
$this->set_data('poster_id', $post['poster_id']);
|
||||||
|
|
||||||
$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->set_data('post_username', (($post['post_username'] != $this->phpbb_container->get('user')->data['username']) ? $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