2222use phpbb \request \request_interface ;
2323use phpbb \symfony_request ;
2424use phpbb \user ;
25+ use phpbb \user_loader ;
2526use Symfony \Component \HttpFoundation \JsonResponse ;
2627use Symfony \Component \HttpFoundation \Response ;
2728use Twig \Environment ;
@@ -58,6 +59,9 @@ class webpush
5859 /** @var request_interface */
5960 protected $ request ;
6061
62+ /** @var user_loader */
63+ protected $ user_loader ;
64+
6165 /** @var user */
6266 protected $ user ;
6367
@@ -81,13 +85,14 @@ class webpush
8185 * @param manager $notification_manager
8286 * @param path_helper $path_helper
8387 * @param request_interface $request
88+ * @param user_loader $user_loader
8489 * @param user $user
8590 * @param Environment $template
8691 * @param string $notification_webpush_table
8792 * @param string $push_subscriptions_table
8893 */
8994 public function __construct (config $ config , controller_helper $ controller_helper , driver_interface $ db , form_helper $ form_helper , language $ language , manager $ notification_manager ,
90- path_helper $ path_helper , request_interface $ request , user $ user , Environment $ template , string $ notification_webpush_table , string $ push_subscriptions_table )
95+ path_helper $ path_helper , request_interface $ request , user_loader $ user_loader , user $ user , Environment $ template , string $ notification_webpush_table , string $ push_subscriptions_table )
9196 {
9297 $ this ->config = $ config ;
9398 $ this ->controller_helper = $ controller_helper ;
@@ -97,6 +102,7 @@ public function __construct(config $config, controller_helper $controller_helper
97102 $ this ->notification_manager = $ notification_manager ;
98103 $ this ->path_helper = $ path_helper ;
99104 $ this ->request = $ request ;
105+ $ this ->user_loader = $ user_loader ;
100106 $ this ->user = $ user ;
101107 $ this ->template = $ template ;
102108 $ this ->notification_webpush_table = $ notification_webpush_table ;
@@ -223,6 +229,9 @@ private function get_notification_data(string $notification_data): string
223229 // Get notification from row_data
224230 $ notification = $ this ->notification_manager ->get_item_type_class ($ row_data ['notification_type_name ' ], $ row_data );
225231
232+ // Load users for notification
233+ $ this ->user_loader ->load_users ($ notification ->users_to_query ());
234+
226235 return json_encode ([
227236 'heading ' => $ this ->config ['sitename ' ],
228237 'title ' => strip_tags ($ notification ->get_title ()),
0 commit comments