aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-09-09 14:55:40 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-09-09 14:55:40 -0500
commite09f25d59707fc842b073fa2909cefc3d16ecbf3 (patch)
treea5be17c213f92b9a6bf23345ed9fcf4b15eda8e0
parent3624d2c50ac1acca767c5642767102b97fd6b832 (diff)
downloadforums-e09f25d59707fc842b073fa2909cefc3d16ecbf3.tar
forums-e09f25d59707fc842b073fa2909cefc3d16ecbf3.tar.gz
forums-e09f25d59707fc842b073fa2909cefc3d16ecbf3.tar.bz2
forums-e09f25d59707fc842b073fa2909cefc3d16ecbf3.tar.xz
forums-e09f25d59707fc842b073fa2909cefc3d16ecbf3.zip
[ticket/11103] Update notifications on post/topic edit
PHPBB3-11103
-rw-r--r--phpBB/includes/functions_posting.php19
-rw-r--r--phpBB/includes/notifications/service.php6
-rw-r--r--phpBB/includes/notifications/type/post.php14
-rw-r--r--phpBB/includes/notifications/type/topic.php8
4 files changed, 34 insertions, 13 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6c5c4535a3..64840bfa51 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2220,12 +2220,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
// Send Notifications
- if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval)
+ if ($post_approval)
{
$notifications = $phpbb_container->get('notifications');
switch ($mode)
{
+ case 'post' :
+ $notifications->add_notifications('topic', array_merge($data, array(
+ 'post_username' => $username,
+ )));
+ break;
+
case 'reply' :
case 'quote' :
$notifications->add_notifications('post', array_merge($data, array(
@@ -2233,8 +2239,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
)));
break;
- case 'post' :
- $notifications->add_notifications('topic', array_merge($data, array(
+ case 'edit_topic' :
+ 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,
)));
break;
diff --git a/phpBB/includes/notifications/service.php b/phpBB/includes/notifications/service.php
index 463798fa07..112cbae3fd 100644
--- a/phpBB/includes/notifications/service.php
+++ b/phpBB/includes/notifications/service.php
@@ -58,10 +58,10 @@ class phpbb_notifications_service
// Merge default options
$options = array_merge(array(
'user_id' => $user->data['user_id'],
- 'limit' => 5,
- 'start' => 0,
'order_by' => 'time',
'order_dir' => 'DESC',
+ 'limit' => 5,
+ 'start' => 0,
), $options);
$notifications = $user_ids = array();
@@ -147,7 +147,7 @@ class phpbb_notifications_service
foreach ($methods as $method)
{
// 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]))
{
diff --git a/phpBB/includes/notifications/type/post.php b/phpBB/includes/notifications/type/post.php
index 04e269737e..efada4220e 100644
--- a/phpBB/includes/notifications/type/post.php
+++ b/phpBB/includes/notifications/type/post.php
@@ -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']);
}
- 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'];
}
- 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('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']);
diff --git a/phpBB/includes/notifications/type/topic.php b/phpBB/includes/notifications/type/topic.php
index f58419a633..ee8c21fd9c 100644
--- a/phpBB/includes/notifications/type/topic.php
+++ b/phpBB/includes/notifications/type/topic.php
@@ -137,7 +137,7 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base
*/
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()
{
- 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)
{
- $this->item_id = $post['post_id'];
+ $this->item_id = $post['topic_id'];
$this->set_data('poster_id', $post['poster_id']);
$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']);