Handle circle deletion event and add cleanup job

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2022-02-24 14:07:51 +01:00
parent b42076ccb8
commit 76fd901062
9 changed files with 150 additions and 11 deletions

View File

@@ -116,12 +116,6 @@
<code>$schemaClosure</code>
</MoreSpecificImplementedParamType>
</file>
<file src="lib/Service/AssignmentService.php">
<InvalidScalarArgument occurrences="2">
<code>$cardId</code>
<code>$cardId</code>
</InvalidScalarArgument>
</file>
<file src="lib/Service/AttachmentService.php">
<InvalidCatch occurrences="1"/>
</file>
@@ -142,11 +136,6 @@
<code>is_resource($content)</code>
</RedundantCondition>
</file>
<file src="lib/Service/StackService.php">
<UndefinedClass occurrences="1">
<code>BadRquestException</code>
</UndefinedClass>
</file>
<file src="lib/Sharing/Listener.php">
<InvalidArgument occurrences="1">
<code>[self::class, 'listenPreShare']</code>

View File

@@ -59,6 +59,12 @@ namespace OCA\Circles\Model {
}
}
namespace OCA\Circles\Events {
class CircleDestroyedEvent extends \OCP\EventDispatcher\Event {
public function __construct(FederatedEvent $federatedEvent, array $results) {}
abstract public function getCircle(): \OCA\Circles\Model\Circle {}
}
}
namespace OCA\Circles\Model\Probes {
class CircleProbe {
public function __construct() {}

View File

@@ -35,6 +35,8 @@ use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Db\StackMapper;
use OCA\Deck\Event\AclCreatedEvent;
use OCA\Deck\Event\AclDeletedEvent;
use OCA\Deck\NoPermissionException;
use OCA\Deck\Notification\NotificationHelper;
use OCP\EventDispatcher\IEventDispatcher;
@@ -375,6 +377,9 @@ class BoardServiceTest extends TestCase {
->method('insert')
->with($acl)
->willReturn($acl);
$this->eventDispatcher->expects(self::once())
->method('dispatchTyped')
->with(new AclCreatedEvent($acl));
$this->assertEquals($expected, $this->service->addAcl(
123, 'user', 'admin', $providedAcl[0], $providedAcl[1], $providedAcl[2]
));
@@ -432,6 +437,9 @@ class BoardServiceTest extends TestCase {
->method('delete')
->with($acl)
->willReturn($acl);
$this->eventDispatcher->expects(self::once())
->method('dispatchTyped')
->with(new AclDeletedEvent($acl));
$this->assertEquals($acl, $this->service->deleteAcl(123));
}
}