Skip to content

Commit a66fd1c

Browse files
committed
Query users for user_loader the way intended
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 777d4f3 commit a66fd1c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

notification/type/status.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ public function find_users_for_notification($type_data, $options = [])
171171
*/
172172
public function get_avatar()
173173
{
174-
$author = (int) $this->get_data('idea_author');
175-
return $author ? $this->user_loader->get_avatar($author, true) : '';
174+
return $this->user_loader->get_avatar($this->get_data('idea_author'), false, true);
176175
}
177176

178177
/**
@@ -182,7 +181,7 @@ public function get_avatar()
182181
*/
183182
public function users_to_query()
184183
{
185-
return [];
184+
return [$this->get_data('idea_author')];
186185
}
187186

188187
/**

tests/notification/status_test.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function test_get_avatar_with_author()
173173

174174
$this->user_loader->expects($this->once())
175175
->method('get_avatar')
176-
->with(5, true)
176+
->with(5, false, true)
177177
->willReturn('<img src="avatar.png">');
178178

179179
$this->assertEquals('<img src="avatar.png">', $this->notification_type->get_avatar());
@@ -187,7 +187,8 @@ public function test_get_avatar_without_author()
187187

188188
public function test_users_to_query()
189189
{
190-
$this->assertEquals([], $this->notification_type->users_to_query());
190+
$this->setNotificationData(['idea_author' => 0]);
191+
$this->assertEquals([0], $this->notification_type->users_to_query());
191192
}
192193

193194
public function test_get_title()

0 commit comments

Comments
 (0)