mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Clear up webhooks
This commit is contained in:
@@ -46,6 +46,12 @@ interface MessageGeneratorInterface
|
||||
*/
|
||||
public function setObjects(Collection $objects): void;
|
||||
|
||||
/**
|
||||
* @param Collection $webhooks
|
||||
* @return void
|
||||
*/
|
||||
public function setWebhooks(Collection $webhooks): void;
|
||||
|
||||
/**
|
||||
* @param int $trigger
|
||||
*/
|
||||
|
@@ -53,6 +53,15 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
private int $version = 0;
|
||||
private Collection $webhooks;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->objects = new Collection();
|
||||
$this->webhooks = new Collection();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -60,7 +69,9 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
// get the webhooks:
|
||||
$this->webhooks = $this->getWebhooks();
|
||||
if (0 === $this->webhooks->count()) {
|
||||
$this->webhooks = $this->getWebhooks();
|
||||
}
|
||||
|
||||
// do some debugging
|
||||
Log::debug(
|
||||
@@ -129,7 +140,9 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
switch ($class) {
|
||||
default:
|
||||
// Line is ignored because all of Firefly III's Models have an id property.
|
||||
Log::error(sprintf('Webhook #%d was given %s#%d to deal with but can\'t extract user ID from it.', $webhook->id, $class, $model->id)); // @phpstan-ignore-line
|
||||
Log::error(
|
||||
sprintf('Webhook #%d was given %s#%d to deal with but can\'t extract user ID from it.', $webhook->id, $class, $model->id)
|
||||
); // @phpstan-ignore-line
|
||||
|
||||
return;
|
||||
case TransactionGroup::class:
|
||||
@@ -240,4 +253,12 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setWebhooks(Collection $webhooks): void
|
||||
{
|
||||
$this->webhooks = $webhooks;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user