Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
Expand Down
243 changes: 150 additions & 93 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/Command/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
IUserManager $userManager,
IConfig $config,
RelatedService $relatedService,
ICacheFactory $cacheFactory
ICacheFactory $cacheFactory,
) {
$this->config = $config;
parent::__construct();
Expand Down Expand Up @@ -102,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
/** @var CirclesManager $circleManager */
$circleManager = Server::get(CirclesManager::class);
} catch (ContainerExceptionInterface | AutoloadNotAllowedException $e) {
} catch (ContainerExceptionInterface|AutoloadNotAllowedException $e) {
throw new Exception('Circles needs to be enabled');
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
LoggerInterface $logger,
IUserSession $userSession,
RelatedService $relatedService,
ConfigService $configService
ConfigService $configService,
) {
parent::__construct($appName, $request);

Expand All @@ -54,7 +54,7 @@ public function __construct(
$this->configService = $configService;
try {
$this->circlesManager = Server::get(CirclesManager::class);
} catch (ContainerExceptionInterface | AutoloadNotAllowedException $e) {
} catch (ContainerExceptionInterface|AutoloadNotAllowedException $e) {
}
}

Expand All @@ -72,7 +72,7 @@ public function getRelatedResources(
string $providerId,
string $itemId,
int $limit = 0,
string $resourceType = ''
string $resourceType = '',
): DataResponse {
if (is_null($this->circlesManager)) {
$this->logger->info('RelatedResources require Circles');
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/CalendarShareRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getCalendarFromRequest(CoreRequestBuilder $qb): Calendar {
/** @var Calendar $calendar */
try {
$calendar = $qb->asItem(Calendar::class);
} catch (InvalidItemException | RowNotFoundException $e) {
} catch (InvalidItemException|RowNotFoundException $e) {
throw new CalendarDataNotFoundException();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/DeckRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getDeckFromRequest(CoreRequestBuilder $qb): DeckBoard {
/** @var DeckBoard $deck */
try {
$deck = $qb->asItem(DeckBoard::class);
} catch (InvalidItemException | RowNotFoundException $e) {
} catch (InvalidItemException|RowNotFoundException $e) {
throw new DeckDataNotFoundException();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/FilesShareRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getItemFromRequest(CoreRequestBuilder $qb): FilesShare {
/** @var FilesShare $share */
try {
$share = $qb->asItem(FilesShare::class);
} catch (InvalidItemException | RowNotFoundException $e) {
} catch (InvalidItemException|RowNotFoundException $e) {
throw new FilesShareNotFoundException();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/TalkRoomRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getRoomFromRequest(CoreRequestBuilder $qb): TalkRoom {
/** @var TalkRoom $room */
try {
$room = $qb->asItem(TalkRoom::class);
} catch (InvalidItemException | RowNotFoundException $e) {
} catch (InvalidItemException|RowNotFoundException $e) {
throw new TalkDataNotFoundException();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Listener/FileShareUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FileShareUpdate implements IEventListener {
private RelatedService $relatedService;

public function __construct(
RelatedService $relatedService
RelatedService $relatedService,
) {
$this->relatedService = $relatedService;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Model/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public function getCalendarUri(): string {

public function importFromDatabase(array $data): IQueryRow {
$this->setCalendarId($this->getInt('id', $data))
->setCalendarName($this->get('displayname', $data))
->setCalendarPrincipalUri($this->get('principaluri', $data))
->setCalendarUri($this->get('uri', $data));
->setCalendarName($this->get('displayname', $data))
->setCalendarPrincipalUri($this->get('principaluri', $data))
->setCalendarUri($this->get('uri', $data));

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Model/CalendarShare.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getUser(): string {

public function importFromDatabase(array $data): IQueryRow {
$this->setCalendarId($this->getInt('resourceid', $data))
->setSharePrincipalUri($this->get('principaluri', $data));
->setSharePrincipalUri($this->get('principaluri', $data));

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Model/DeckBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public function getLastModified(): int {
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setBoardId($this->getInt('id', $data))
->setBoardName($this->get('title', $data))
->setOwner($this->get('owner', $data))
->setLastModified($this->getInt('last_modified', $data));
->setBoardName($this->get('title', $data))
->setOwner($this->get('owner', $data))
->setLastModified($this->getInt('last_modified', $data));

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Model/DeckShare.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public function getRecipientId(): string {
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setBoardId($this->getInt('board_id', $data))
->setRecipientType($this->getInt('type', $data))
->setRecipientId($this->get('participant', $data));
->setRecipientType($this->getInt('type', $data))
->setRecipientId($this->get('participant', $data));

return $this;
}
Expand Down
12 changes: 6 additions & 6 deletions lib/Model/FilesShare.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ public function getShareCreator(): string {

public function importFromDatabase(array $data): IQueryRow {
$this->setShareType($this->getInt('share_type', $data))
->setSharedWith($this->get('share_with', $data))
->setShareCreator($this->get('uid_initiator', $data))
->setFileId($this->getInt('file_source', $data))
->setFileOwner($this->get('uid_owner', $data))
->setFileTarget($this->get('file_target', $data))
->setShareTime($this->getInt('stime', $data));
->setSharedWith($this->get('share_with', $data))
->setShareCreator($this->get('uid_initiator', $data))
->setFileId($this->getInt('file_source', $data))
->setFileOwner($this->get('uid_owner', $data))
->setFileTarget($this->get('file_target', $data))
->setShareTime($this->getInt('stime', $data));

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Model/RelatedResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function getUrl(): string {
public function improve(
float $quality,
string $type,
bool $diminishingReturn = true
bool $diminishingReturn = true,
): IRelatedResource {
$quality = ($this->currentQuality[$type] ?? $quality);
$this->score = $this->score * $quality;
Expand Down
2 changes: 1 addition & 1 deletion lib/Model/TalkActor.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getActorId(): string {
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setActorType($this->get('actor_type', $data))
->setActorId($this->get('actor_id', $data));
->setActorId($this->get('actor_id', $data));

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Model/TalkRoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public function getToken(): string {
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setRoomId($this->getInt('id', $data))
->setRoomName($this->get('name', $data))
->setRoomType($this->getInt('type', $data))
->setToken($this->get('token', $data));
->setRoomName($this->get('name', $data))
->setRoomType($this->getInt('type', $data))
->setToken($this->get('token', $data));

return $this;
}
Expand Down
24 changes: 12 additions & 12 deletions lib/RelatedResourceProviders/CalendarRelatedResourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CalendarRelatedResourceProvider implements IRelatedResourceProvider {
public function __construct(
IURLGenerator $urlGenerator,
IL10N $l10n,
CalendarShareRequest $calendarShareRequest
CalendarShareRequest $calendarShareRequest,
) {
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
Expand Down Expand Up @@ -134,17 +134,17 @@ private function convertToRelatedResource(Calendar $calendar): IRelatedResource
}

$related->setTitle($calendar->getCalendarName())
->setSubtitle($this->l10n->t('Calendar'))
->setTooltip($this->l10n->t('Calendar "%s"', $calendar->getCalendarName()))
->setIcon(
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->imagePath(
'calendar',
'calendar.svg'
)
->setSubtitle($this->l10n->t('Calendar'))
->setTooltip($this->l10n->t('Calendar "%s"', $calendar->getCalendarName()))
->setIcon(
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->imagePath(
'calendar',
'calendar.svg'
)
)
->setUrl($url);
)
->setUrl($url);

$keywords = preg_split(
'/[\/_\-. ]/',
Expand Down Expand Up @@ -173,7 +173,7 @@ private function processCalendarShare(
$related->addToVirtualGroup($participant->getSingleId());
} else {
$related->addRecipient($participant->getSingleId())
->setAsGroupShared();
->setAsGroupShared();
}
} catch (Exception $e) {
}
Expand All @@ -200,6 +200,6 @@ private function completeShareDetails(CalendarShare $share): void {
}

$share->setType($type)
->setUser($user);
->setUser($user);
}
}
28 changes: 14 additions & 14 deletions lib/RelatedResourceProviders/DeckRelatedResourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DeckRelatedResourceProvider implements IRelatedResourceProvider {
public function __construct(
IUrlGenerator $urlGenerator,
IL10N $l10n,
DeckRequest $deckSharesRequest
DeckRequest $deckSharesRequest,
) {
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
Expand Down Expand Up @@ -112,25 +112,25 @@ public function improveRelatedResource(CirclesManager $circlesManager, IRelatedR
private function convertToRelatedResource(DeckBoard $board): IRelatedResource {
$url = '';
try {
$url =
$this->urlGenerator->linkToRouteAbsolute('deck.page.index')
$url
= $this->urlGenerator->linkToRouteAbsolute('deck.page.index')
. '#/board/' . $board->getBoardId();
} catch (Exception $e) {
}

$related = new RelatedResource(self::PROVIDER_ID, (string)$board->getBoardId());
$related->setTitle($board->getBoardName())
->setSubtitle($this->l10n->t('Deck'))
->setTooltip($this->l10n->t('Deck board "%s"', $board->getBoardName()))
->setIcon(
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->imagePath(
'deck',
'deck.svg'
)
->setSubtitle($this->l10n->t('Deck'))
->setTooltip($this->l10n->t('Deck board "%s"', $board->getBoardName()))
->setIcon(
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->imagePath(
'deck',
'deck.svg'
)
)
->setUrl($url);
)
->setUrl($url);

$related->setMetaInt(RelatedResource::ITEM_LAST_UPDATE, $board->getLastModified());

Expand All @@ -150,15 +150,15 @@ private function convertToRelatedResource(DeckBoard $board): IRelatedResource {
private function processDeckShare(
CirclesManager $circlesManager,
RelatedResource $related,
DeckShare $share
DeckShare $share,
) {
try {
$participant = $this->convertDeckShare($circlesManager, $share);
if ($share->getRecipientType() === IShare::TYPE_USER) {
$related->addToVirtualGroup($participant->getSingleId());
} else {
$related->addRecipient($participant->getSingleId())
->setAsGroupShared();
->setAsGroupShared();
}
} catch (Exception $e) {
}
Expand Down
12 changes: 6 additions & 6 deletions lib/RelatedResourceProviders/FilesRelatedResourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function improveRelatedResource(CirclesManager $circlesManager, IRelatedR
}

$paths = $this->rootFolder->getUserFolder($current->getUserId())
->getById((int)$entry->getItemId());
->getById((int)$entry->getItemId());

if (sizeof($paths) > 0) {
$entry->setTitle($paths[0]->getName());
Expand Down Expand Up @@ -180,7 +180,7 @@ private function convertToRelatedResource(FilesShare $share): IRelatedResource {
private function managerGroupFolders(
CirclesManager $circlesManager,
?IRelatedResource $related,
array $itemEntries
array $itemEntries,
): ?IRelatedResource {
foreach ($itemEntries as $entry) {
if (($entry['type'] ?? '') !== 'groupfolder') {
Expand Down Expand Up @@ -223,7 +223,7 @@ private function getItemIdsFromParentPath(CirclesManager $circlesManager, int $i
}

$paths = $this->rootFolder->getUserFolder($current->getUserId())
->getById($itemId);
->getById($itemId);

$itemEntries = [];
foreach ($paths as $path) {
Expand Down Expand Up @@ -256,7 +256,7 @@ private function getItemIdsFromParentPath(CirclesManager $circlesManager, int $i
private function processShareRecipient(
CirclesManager $circlesManager,
RelatedResource $related,
FilesShare $share
FilesShare $share,
) {
try {
$sharedWith = $this->convertShareRecipient(
Expand All @@ -280,7 +280,7 @@ private function processShareRecipient(
);
} else {
$related->addRecipient($sharedWith->getSingleId())
->setAsGroupShared();
->setAsGroupShared();
}
} catch (Exception $e) {
}
Expand All @@ -297,7 +297,7 @@ private function processShareRecipient(
private function convertShareRecipient(
CirclesManager $circlesManager,
int $shareType,
string $sharedWith
string $sharedWith,
): FederatedUser {
$type = match ($shareType) {
IShare::TYPE_USER => Member::TYPE_USER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function convertToRelatedResource(array $folderData): IRelatedResource {
public function processApplicableMap(
CirclesManager $circlesManager,
RelatedResource $related,
array $applicableMap
array $applicableMap,
): void {
foreach ($applicableMap as $k => $entry) {
$entityId = '';
Expand All @@ -156,7 +156,7 @@ public function processApplicableMap(
}

$related->addRecipient($entityId)
->setAsGroupShared();
->setAsGroupShared();
}
}

Expand Down
Loading
Loading