code fixes

This commit is contained in:
Dennis Eichhorn 2024-03-15 20:24:38 +00:00
parent 9ce7a56dde
commit 3d49a7b363
3 changed files with 27 additions and 16 deletions

View File

@ -45,8 +45,19 @@ use phpOMS\Utils\Parser\Markdown\Markdown;
*/
final class ApiController extends Controller
{
// @todo Create another notification whenever a comment is created for a card
// The card owner and all previous commentators should receive a notification
/**
* Create a notification for a card
*
* @param KanbanCard $card Card to create notification for
* @param RequestAbstract $request Request
*
* @return void
*
* @todo Create another notification whenever a comment is created for a card
* The card owner and all previous commentators should receive a notification
*
* @since 1.0.0
*/
private function createCardNotifications(KanbanCard $card, RequestAbstract $request) : void
{
$accounts = AccountMapper::findReadPermission(
@ -57,15 +68,15 @@ final class ApiController extends Controller
);
foreach ($accounts as $account) {
$notification = new Notification();
$notification->module = self::NAME;
$notification->title = $card->name;
$notification->createdBy = $card->createdBy;
$notification = new Notification();
$notification->module = self::NAME;
$notification->title = $card->name;
$notification->createdBy = $card->createdBy;
$notification->createdFor = new NullAccount($account);
$notification->type = NotificationType::CREATE;
$notification->category = PermissionCategory::CARD;
$notification->element = $card->id;
$notification->redirect = '{/base}/kanban/card?{?}&id=' . $card->id;
$notification->type = NotificationType::CREATE;
$notification->category = PermissionCategory::CARD;
$notification->element = $card->id;
$notification->redirect = '{/base}/kanban/card?{?}&id=' . $card->id;
$this->createModel($request->header->account, $notification, NotificationMapper::class, 'notification', $request->getOrigin());
}
@ -129,7 +140,7 @@ final class ApiController extends Controller
&& ($commentApi = $this->app->moduleManager->get('Comments', 'Api'))::ID > 0
) {
/** @var \Modules\Comments\Controller\ApiController $commentApi */
$commnetList = $commentApi->createCommentList();
$commnetList = $commentApi->createCommentList();
$card->commentList = $commnetList;
}

View File

@ -64,10 +64,10 @@ final class SearchController extends Controller
'link' => '{/base}/kanban/card?id=' . $doc->id,
'account' => '',
'createdAt' => $doc->createdAt,
'image' => '',
'tags' => $doc->tags,
'type' => 'list_links',
'module' => 'Kanban',
'image' => '',
'tags' => $doc->tags,
'type' => 'list_links',
'module' => 'Kanban',
];
}

View File

@ -51,7 +51,7 @@ final class KanbanCardMapper extends DataMapperFactory
'kanban_card_color' => ['name' => 'kanban_card_color', 'type' => 'string', 'internal' => 'color'],
'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'],
'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'],
'kanban_card_comment_list' => ['name' => 'kanban_card_comment_list', 'type' => 'int', 'internal' => 'commentList'],
'kanban_card_comment_list' => ['name' => 'kanban_card_comment_list', 'type' => 'int', 'internal' => 'commentList'],
'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
'kanban_card_created_by' => ['name' => 'kanban_card_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
];