OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
39
app/Domain/Tickets/Events/MilestoneCreated.php
Normal file
39
app/Domain/Tickets/Events/MilestoneCreated.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired when a milestone is created.
|
||||
*/
|
||||
final class MilestoneCreated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int|null $milestoneId The created milestone id; null when the emit site doesn't capture it.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly ?int $milestoneId = null,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.milestone_created'];
|
||||
}
|
||||
}
|
||||
39
app/Domain/Tickets/Events/MilestoneDeleted.php
Normal file
39
app/Domain/Tickets/Events/MilestoneDeleted.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a milestone was deleted.
|
||||
*/
|
||||
final class MilestoneDeleted implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int $milestoneId The deleted milestone id.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $milestoneId,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.milestone_deleted'];
|
||||
}
|
||||
}
|
||||
39
app/Domain/Tickets/Events/MilestoneUpdated.php
Normal file
39
app/Domain/Tickets/Events/MilestoneUpdated.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a milestone was updated.
|
||||
*/
|
||||
final class MilestoneUpdated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int $milestoneId The updated milestone id.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $milestoneId,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.milestone_updated'];
|
||||
}
|
||||
}
|
||||
39
app/Domain/Tickets/Events/StatusLabelsUpdated.php
Normal file
39
app/Domain/Tickets/Events/StatusLabelsUpdated.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a project's ticket status labels were saved.
|
||||
*/
|
||||
final class StatusLabelsUpdated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int|null $projectId The project whose status labels changed.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly ?int $projectId = null,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.statusLabels_updated'];
|
||||
}
|
||||
}
|
||||
39
app/Domain/Tickets/Events/TicketCreated.php
Normal file
39
app/Domain/Tickets/Events/TicketCreated.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a ticket (including subtasks) was created.
|
||||
*/
|
||||
final class TicketCreated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int|null $ticketId The created ticket id; null when the emit site doesn't capture it.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly ?int $ticketId = null,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.ticket_created'];
|
||||
}
|
||||
}
|
||||
39
app/Domain/Tickets/Events/TicketDeleted.php
Normal file
39
app/Domain/Tickets/Events/TicketDeleted.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a ticket was deleted.
|
||||
*/
|
||||
final class TicketDeleted implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int $ticketId The deleted ticket id.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $ticketId,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.ticket_deleted'];
|
||||
}
|
||||
}
|
||||
48
app/Domain/Tickets/Events/TicketListFilter.php
Normal file
48
app/Domain/Tickets/Events/TicketListFilter.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithFilters;
|
||||
use Leantime\Core\Events\Contracts\LeantimeFilter;
|
||||
|
||||
/**
|
||||
* Filters the grouped ticket list before it is handed to the list/table templates.
|
||||
* Listeners receive the grouped tickets array and must return it (possibly modified).
|
||||
*/
|
||||
final class TicketListFilter implements LeantimeFilter
|
||||
{
|
||||
use InteractsWithFilters;
|
||||
|
||||
/**
|
||||
* @param array $tickets The grouped tickets to filter.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site ran under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public array $tickets,
|
||||
private readonly ?string $legacyHook = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* The grouped tickets array threaded through the pipeline.
|
||||
*/
|
||||
public function payload(): mixed
|
||||
{
|
||||
return $this->tickets;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.tickets.services.tickets.'.$this->legacyHook.'.filterTickets'];
|
||||
}
|
||||
}
|
||||
56
app/Domain/Tickets/Events/TicketStatusUpdated.php
Normal file
56
app/Domain/Tickets/Events/TicketStatusUpdated.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired from the repository when a ticket's status column changes (kanban moves,
|
||||
* inline patches). Carries the legacy payload keys (ticketId/status/action/handler)
|
||||
* that existing plugin listeners read.
|
||||
*
|
||||
* The legacy bridge emits a SUPERSET of each historical payload: the patchTicket site
|
||||
* historically passed no `handler` key, so its bridged payload now also carries
|
||||
* `handler => null`. This is additive and safe — consumers read keys by name
|
||||
* (`$payload['handler'] ?? …`), never by exact key-set/count — and the kanban
|
||||
* (updateTicketStatus) site, the only live consumer, always carried `handler`.
|
||||
*/
|
||||
final class TicketStatusUpdated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* Legacy payload discriminator kept for plugin listeners that switch on it.
|
||||
*/
|
||||
public string $action = 'ticketStatusUpdate';
|
||||
|
||||
/**
|
||||
* @param int $ticketId The ticket whose status changed.
|
||||
* @param mixed $status The new status value.
|
||||
* @param mixed $handler Optional handler context passed by kanban updates.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $ticketId,
|
||||
public readonly mixed $status,
|
||||
public readonly mixed $handler = null,
|
||||
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.tickets.repositories.tickets.'.$this->legacyHook.'.ticketStatusUpdate'];
|
||||
}
|
||||
}
|
||||
40
app/Domain/Tickets/Events/TicketUpdated.php
Normal file
40
app/Domain/Tickets/Events/TicketUpdated.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithEvents;
|
||||
use Leantime\Core\Events\Contracts\LeantimeEvent;
|
||||
|
||||
/**
|
||||
* Fired after a ticket (including subtasks) was updated.
|
||||
*/
|
||||
final class TicketUpdated implements LeantimeEvent
|
||||
{
|
||||
use InteractsWithEvents;
|
||||
|
||||
/**
|
||||
* @param int|null $ticketId The updated ticket id; null for bulk updates (sorting,
|
||||
* kanban status+sorting) where no single id applies.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site fired under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly ?int $ticketId = null,
|
||||
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.tickets.services.tickets.'.$this->legacyHook.'.ticket_updated'];
|
||||
}
|
||||
}
|
||||
51
app/Domain/Tickets/Events/TodoWidgetTasksFilter.php
Normal file
51
app/Domain/Tickets/Events/TodoWidgetTasksFilter.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Events;
|
||||
|
||||
use Leantime\Core\Events\Concerns\InteractsWithFilters;
|
||||
use Leantime\Core\Events\Contracts\LeantimeFilter;
|
||||
|
||||
/**
|
||||
* Filters the current user's tasks before the My-ToDos widget renders them.
|
||||
* Listeners receive the grouped tickets array and must return it (possibly modified).
|
||||
*/
|
||||
final class TodoWidgetTasksFilter implements LeantimeFilter
|
||||
{
|
||||
use InteractsWithFilters;
|
||||
|
||||
/**
|
||||
* @param array $tickets The grouped widget tickets to filter.
|
||||
* @param bool $hierarchical True when tickets are grouped hierarchically
|
||||
* (milestone/parent nesting) instead of flat groups.
|
||||
* @param string|null $legacyHook TEMPORARY (migration window): the emitting method name —
|
||||
* pass __FUNCTION__ — used to rebuild the exact historical
|
||||
* string name this site ran under for plugin listeners.
|
||||
*/
|
||||
public function __construct(
|
||||
public array $tickets,
|
||||
public readonly bool $hierarchical = false,
|
||||
private readonly ?string $legacyHook = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* The grouped tickets array threaded through the pipeline.
|
||||
*/
|
||||
public function payload(): mixed
|
||||
{
|
||||
return $this->tickets;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.tickets.services.tickets.'.$this->legacyHook.'.myTodoWidgetTasks'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user