From 287c2550b8689a6fd34043ec4b5652997e9a6ab7 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Wed, 13 Nov 2013 23:58:21 -0800 Subject: [ticket/12008] Update the run time value for the prune notifications cron task PHPBB3-12008 --- phpBB/phpbb/notification/manager.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index d77a936413..2e8652771b 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -27,6 +27,9 @@ class manager /** @var \phpbb\user_loader */ protected $user_loader; + /** @var \phpbb\config\config */ + protected $config; + /** @var \phpbb\db\driver\driver */ protected $db; @@ -58,6 +61,7 @@ class manager * @param array $notification_methods * @param ContainerBuilder $phpbb_container * @param \phpbb\user_loader $user_loader + * @param \phpbb\config\config $config * @param \phpbb\db\driver\driver $db * @param \phpbb\user $user * @param string $phpbb_root_path @@ -67,13 +71,14 @@ class manager * @param string $user_notifications_table * @return \phpbb\notification\manager */ - public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) + public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) { $this->notification_types = $notification_types; $this->notification_methods = $notification_methods; $this->phpbb_container = $phpbb_container; $this->user_loader = $user_loader; + $this->config = $config; $this->db = $db; $this->cache = $cache; $this->user = $user; @@ -797,6 +802,8 @@ class manager WHERE notification_time < ' . (int) $timestamp . (($only_read) ? ' AND notification_read = 1' : ''); $this->db->sql_query($sql); + + $this->config->set('read_notification_last_gc', time(), false); } /** -- cgit v1.2.1 From 44b6f45759485cc33bb71ff50a715f39a8d60089 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 08:11:17 -0800 Subject: [ticket/11484] Display login box for users following email notification link. The link used for the latest post now uses view=unread so redirecting the user using the value for the e parameter is no longer necessary. PHPBB3-11484 --- phpBB/phpbb/notification/type/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 9d5c7b0a4c..c0ef184a19 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -234,7 +234,7 @@ class post extends \phpbb\notification\type\base 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}", - 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&view=unread#unread", + 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&e=1&view=unread#unread", 'U_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", 'U_FORUM' => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}", -- cgit v1.2.1 From bcf347420e4fe400d02a6ee58e63839f18a86362 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 13:02:26 -0800 Subject: [ticket/11959] Trim the list of users from post notifications. PHPBB3-11959 --- phpBB/phpbb/notification/type/post.php | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 9d5c7b0a4c..0d07df8adf 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -183,6 +183,10 @@ class post extends \phpbb\notification\type\base 'username' => $this->get_data('post_username'), )), $responders); + $responders_cnt = sizeof($responders); + $responders = $this->trim_user_ary($responders); + $extra_cnt = $responders_cnt - sizeof($responders); + foreach ($responders as $responder) { if ($responder['username']) @@ -194,11 +198,18 @@ class post extends \phpbb\notification\type\base $usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile'); } } + $lang_key = $this->language_key; + + if ($responders_cnt > 4) + { + $lang_key .= '_TRIMMED'; + } return $this->user->lang( - $this->language_key, + $lang_key, implode(', ', $usernames), - censor_text($this->get_data('topic_title')) + censor_text($this->get_data('topic_title')), + $extra_cnt ); } @@ -272,6 +283,22 @@ class post extends \phpbb\notification\type\base } } + return $this->trim_user_ary($users); + } + + /** + * Trim the user array passed down to 3 users if the array contains + * more than 4 users. + * + * @param array $users Array of users + * @return array Trimmed array of user_ids + */ + public function trim_user_ary($users) + { + if (sizeof($users) > 4) + { + array_splice($users, 3); + } return $users; } -- cgit v1.2.1 From 43f454a6c6347827a01a1e31478a846ad05bc7f4 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 13:15:08 -0800 Subject: [ticket/11959] Use COMMA_SEPARATOR to join the user list. PHPBB3-11959 --- phpBB/phpbb/notification/type/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 0d07df8adf..e9f9d48978 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -207,7 +207,7 @@ class post extends \phpbb\notification\type\base return $this->user->lang( $lang_key, - implode(', ', $usernames), + implode($this->user->lang['COMMA_SEPARATOR'], $usernames), censor_text($this->get_data('topic_title')), $extra_cnt ); -- cgit v1.2.1 From e3a28e5e2a451794b322be90e1aef9ad4aee256b Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 13:18:28 -0800 Subject: [ticket/11959] Rename $extra_cnt to something more descriptive. PHPBB3-11959 --- phpBB/phpbb/notification/type/post.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/notification') diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index e9f9d48978..87bd4331b6 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -185,7 +185,7 @@ class post extends \phpbb\notification\type\base $responders_cnt = sizeof($responders); $responders = $this->trim_user_ary($responders); - $extra_cnt = $responders_cnt - sizeof($responders); + $trimmed_responders_cnt = $responders_cnt - sizeof($responders); foreach ($responders as $responder) { @@ -200,7 +200,7 @@ class post extends \phpbb\notification\type\base } $lang_key = $this->language_key; - if ($responders_cnt > 4) + if ($trimmed_responders_cnt) { $lang_key .= '_TRIMMED'; } @@ -209,7 +209,7 @@ class post extends \phpbb\notification\type\base $lang_key, implode($this->user->lang['COMMA_SEPARATOR'], $usernames), censor_text($this->get_data('topic_title')), - $extra_cnt + $trimmed_responders_cnt ); } -- cgit v1.2.1