fix: Limit card activities for deleted cards
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -17,9 +17,9 @@ class BoardContext implements Context {
|
||||
/** @var array last card response */
|
||||
private $card = null;
|
||||
private array $storedCards = [];
|
||||
private ?array $activities = null;
|
||||
|
||||
/** @var ServerContext */
|
||||
private $serverContext;
|
||||
private ServerContext $serverContext;
|
||||
|
||||
/** @BeforeScenario */
|
||||
public function gatherContexts(BeforeScenarioScope $scope) {
|
||||
@@ -303,4 +303,23 @@ class BoardContext implements Context {
|
||||
public function deleteTheBoard() {
|
||||
$this->requestContext->sendJSONrequest('DELETE', '/index.php/apps/deck/boards/' . $this->board['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given /^get the activities for the last card$/
|
||||
*/
|
||||
public function getActivitiesForTheLastCard() {
|
||||
$card = $this->getLastUsedCard();
|
||||
$this->requestContext->sendOCSRequest('GET', '/apps/activity/api/v2/activity/filter?format=json&type=deck&since=0&object_type=deck_card&object_id=' . $card['id'] . '&limit=50');
|
||||
$this->activities = json_decode((string)$this->getResponse()->getBody(), true)['ocs']['data'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the fetched activities should have :count entries
|
||||
*/
|
||||
public function theFetchedActivitiesShouldHaveEntries($count) {
|
||||
Assert::assertEquals($count, count($this->activities ?? []));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -103,8 +103,13 @@ Feature: decks
|
||||
And uploads an attachment to the last used card
|
||||
And remember the last attachment as "my-attachment"
|
||||
And post a comment with content "My first comment" on the card
|
||||
When get the activities for the last card
|
||||
Then the fetched activities should have 3 entries
|
||||
And delete the card
|
||||
|
||||
When get the activities for the last card
|
||||
Then the fetched activities should have 0 entries
|
||||
|
||||
When fetching the attachment "my-attachment" for the card "deletedCard"
|
||||
Then the response should have a status code 403
|
||||
|
||||
|
||||
Reference in New Issue
Block a user