OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
54
app/Domain/Blueprints/Events/CanvasItemUpdated.php
Normal file
54
app/Domain/Blueprints/Events/CanvasItemUpdated.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Blueprints\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a canvas item was updated — for ANY canvas type (goal, idea,
|
||||
* wiki, logic model, …), since all canvas items share the zp_canvas_items
|
||||
* table and the same update chokepoints.
|
||||
*
|
||||
* The event is deliberately generic: consumers that only care about a specific
|
||||
* canvas (e.g. the strategy Logic Model, which propagates edits down to the
|
||||
* work it generated) resolve the item's canvas and filter themselves.
|
||||
* `changedFields` is best-effort and never authoritative: for patches it is
|
||||
* the set of allow-listed keys that were written (which can include a key set
|
||||
* to the value it already held), and for full updates it is over-inclusive
|
||||
* (every mirrored column). Either way it says "possibly touched", not
|
||||
* "definitely changed", so listeners must still no-op when the field they
|
||||
* mirror is actually unchanged.
|
||||
*/
|
||||
final class CanvasItemUpdated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int $canvasItemId The updated canvas item id.
|
||||
* @param array<int, string> $changedFields Best-effort names of the fields possibly
|
||||
* written (see class doc); not authoritative.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the historical string
|
||||
* name for legacy string-based listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $canvasItemId,
|
||||
public readonly array $changedFields = [],
|
||||
private readonly ?string $legacyHook = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* The exact historical string name of the emitting site. Remove with the migration window.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function legacyHooks(): array
|
||||
{
|
||||
if ($this->legacyHook === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return ['leantime.domain.blueprints.services.blueprints.'.$this->legacyHook.'.canvas_item_updated'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user