Merge pull request #6641 from nextcloud/fix/activity

fix: Proper rich object formats
This commit is contained in:
Luka Trovic
2025-01-03 10:50:58 +01:00
committed by GitHub

View File

@@ -109,7 +109,7 @@ class DeckProvider implements IProvider {
} }
$board = [ $board = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $event->getObjectId(), 'id' => (string)$event->getObjectId(),
'name' => $event->getObjectName(), 'name' => $event->getObjectName(),
'link' => $this->deckUrl('/board/' . $event->getObjectId()), 'link' => $this->deckUrl('/board/' . $event->getObjectId()),
]; ];
@@ -126,7 +126,7 @@ class DeckProvider implements IProvider {
} }
$card = [ $card = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $event->getObjectId(), 'id' => (string)$event->getObjectId(),
'name' => $event->getObjectName(), 'name' => $event->getObjectName(),
]; ];
@@ -213,7 +213,7 @@ class DeckProvider implements IProvider {
if (array_key_exists($paramName, $subjectParams)) { if (array_key_exists($paramName, $subjectParams)) {
$params[$paramName] = [ $params[$paramName] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams[$paramName]['id'], 'id' => (string)$subjectParams[$paramName]['id'],
'name' => $subjectParams[$paramName]['title'], 'name' => $subjectParams[$paramName]['title'],
'link' => $this->deckUrl('/board/' . $subjectParams[$paramName]['id'] . '/'), 'link' => $this->deckUrl('/board/' . $subjectParams[$paramName]['id'] . '/'),
]; ];
@@ -224,7 +224,7 @@ class DeckProvider implements IProvider {
if (array_key_exists($paramName, $subjectParams)) { if (array_key_exists($paramName, $subjectParams)) {
$params[$paramName] = [ $params[$paramName] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams[$paramName]['id'], 'id' => (string)$subjectParams[$paramName]['id'],
'name' => $subjectParams[$paramName]['title'], 'name' => $subjectParams[$paramName]['title'],
]; ];
} }
@@ -235,7 +235,7 @@ class DeckProvider implements IProvider {
if (array_key_exists($paramName, $subjectParams)) { if (array_key_exists($paramName, $subjectParams)) {
$params[$paramName] = [ $params[$paramName] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams[$paramName]['id'], 'id' => (string)$subjectParams[$paramName]['id'],
'name' => $subjectParams[$paramName]['data'], 'name' => $subjectParams[$paramName]['data'],
'link' => $this->urlGenerator->linkToRoute('deck.attachment.display', ['cardId' => $subjectParams['card']['id'], 'attachmentId' => $subjectParams['attachment']['id']]), 'link' => $this->urlGenerator->linkToRoute('deck.attachment.display', ['cardId' => $subjectParams['card']['id'], 'attachmentId' => $subjectParams['attachment']['id']]),
]; ];
@@ -259,7 +259,7 @@ class DeckProvider implements IProvider {
if (array_key_exists('label', $subjectParams)) { if (array_key_exists('label', $subjectParams)) {
$params['label'] = [ $params['label'] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams['label']['id'], 'id' => (string)$subjectParams['label']['id'],
'name' => $subjectParams['label']['title'] 'name' => $subjectParams['label']['title']
]; ];
} }
@@ -278,7 +278,7 @@ class DeckProvider implements IProvider {
} else { } else {
$params['acl'] = [ $params['acl'] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams['acl']['participant'], 'id' => (string)$subjectParams['acl']['participant'],
'name' => $subjectParams['acl']['participant'] 'name' => $subjectParams['acl']['participant']
]; ];
} }
@@ -294,7 +294,7 @@ class DeckProvider implements IProvider {
$event->setParsedMessage($comment->getMessage()); $event->setParsedMessage($comment->getMessage());
$params['comment'] = [ $params['comment'] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams['comment'], 'id' => (string)$subjectParams['comment'],
'name' => $comment->getMessage() 'name' => $comment->getMessage()
]; ];
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
@@ -343,22 +343,22 @@ class DeckProvider implements IProvider {
if (array_key_exists('before', $subjectParams)) { if (array_key_exists('before', $subjectParams)) {
$params['before'] = [ $params['before'] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams['before'], 'id' => (string)$subjectParams['before'],
'name' => $subjectParams['before'] 'name' => $subjectParams['before'] ?? ''
]; ];
} }
if (array_key_exists('after', $subjectParams)) { if (array_key_exists('after', $subjectParams)) {
$params['after'] = [ $params['after'] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams['after'], 'id' => (string)$subjectParams['after'],
'name' => $subjectParams['after'] 'name' => $subjectParams['after'] ?? ''
]; ];
} }
if (array_key_exists('card', $subjectParams) && $event->getSubject() === ActivityManager::SUBJECT_CARD_UPDATE_TITLE) { if (array_key_exists('card', $subjectParams) && $event->getSubject() === ActivityManager::SUBJECT_CARD_UPDATE_TITLE) {
$params['card'] = [ $params['card'] = [
'type' => 'highlight', 'type' => 'highlight',
'id' => $subjectParams['after'], 'id' => (string)$subjectParams['after'],
'name' => $subjectParams['after'] 'name' => $subjectParams['after'] ?? ''
]; ];
} }
return $params; return $params;