mirror of
https://github.com/flarum/core.git
synced 2025-08-11 02:44:04 +02:00
feat: add option for filtering read stickied on all discussions page (#4073)
Co-authored-by: Adrian McCay <2762877+adrianmccay@users.noreply.github.com>
This commit is contained in:
@@ -104,6 +104,40 @@ class ListDiscussionsTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing([2, 4, 3, 1], Arr::pluck($data['data'], 'id'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function list_discussions_sticky_first_all_read_as_user_filter_read_off()
|
||||
{
|
||||
$this->setting('flarum-sticky.only_sticky_unread_discussions', false);
|
||||
$response = $this->send(
|
||||
$this->request('GET', '/api/discussions', [
|
||||
'authenticatedAs' => 3
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals([3, 1, 2, 4], Arr::pluck($data['data'], 'id'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function list_discussions_sticky_first_all_read_as_user_filter_read_on()
|
||||
{
|
||||
$this->setting('flarum-sticky.only_sticky_unread_discussions', true);
|
||||
$response = $this->send(
|
||||
$this->request('GET', '/api/discussions', [
|
||||
'authenticatedAs' => 3
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals([2, 4, 3, 1], Arr::pluck($data['data'], 'id'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function list_discussions_shows_stick_first_on_a_tag()
|
||||
{
|
||||
|
Reference in New Issue
Block a user