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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"bamarni/composer-bin-plugin": "^1.8"
},
"require-dev": {
"roave/security-advisories": "dev-master",
"roave/security-advisories": "dev-latest",
"phpunit/phpunit": "^9",
"nextcloud/coding-standard": "^1.1",
"nextcloud/ocp": "dev-master"
Expand Down
688 changes: 458 additions & 230 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Cron/SessionsCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(

protected function run($argument) {
$this->logger->debug('Run cleanup job for deck sessions');

$removedSessions = $this->sessionService->removeInactiveSessions();
$this->logger->debug('Removed ' . $removedSessions . ' inactive sessions');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/ACardEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

abstract class ACardEvent extends Event {
private $card;

public function __construct(Card $card) {
parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion lib/Event/BoardUpdatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class BoardUpdatedEvent extends Event {
private $boardId;

public function __construct(int $boardId) {
parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion lib/Event/SessionClosedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class SessionClosedEvent extends Event {
private $boardId;
private $userId;

public function __construct(int $boardId, string $userId) {
parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion lib/Event/SessionCreatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class SessionCreatedEvent extends Event {
private $boardId;
private $userId;

public function __construct(int $boardId, string $userId) {
parent::__construct();

Expand Down
8 changes: 4 additions & 4 deletions lib/Listeners/LiveUpdateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public function handle(Event $event): void {
// else, preventing this person from getting updates
$causingSessionToken = $this->request->getHeader('x-nc-deck-session');
if (
$event instanceof SessionCreatedEvent ||
$event instanceof SessionClosedEvent ||
$event instanceof BoardUpdatedEvent ||
$event instanceof AAclEvent
$event instanceof SessionCreatedEvent
|| $event instanceof SessionClosedEvent
|| $event instanceof BoardUpdatedEvent
|| $event instanceof AAclEvent
) {
$this->sessionService->notifyAllSessions($this->queue, $event->getBoardId(), NotifyPushEvents::DeckBoardUpdate, [
'id' => $event->getBoardId()
Expand Down
4 changes: 2 additions & 2 deletions lib/Provider/DeckProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ public function improveSearchRequest(ISearchRequest $searchRequest) {
public function improveSearchResult(ISearchResult $searchResult) {
foreach ($searchResult->getDocuments() as $document) {
try {
$board =
$this->fullTextSearchService->getBoardFromCardId((int)$document->getId());
$board
= $this->fullTextSearchService->getBoardFromCardId((int)$document->getId());
$path = '/board/' . $board->getId() . '/card/' . $document->getId();
$document->setLink($this->urlGenerator->linkToRoute('deck.page.index') . $path);
} catch (DoesNotExistException $e) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Search/FilterStringParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private function parseFilterToken(SearchQuery $query, string $token): bool {
$orEquals = $param[1] === '=';
$value = $orEquals ? substr($param, 2) : substr($param, 1);
$comparator = (
($param[0] === '<' ? SearchQuery::COMPARATOR_LESS : 0) |
($param[0] === '>' ? SearchQuery::COMPARATOR_MORE : 0) |
($orEquals ? SearchQuery::COMPARATOR_EQUAL : 0)
($param[0] === '<' ? SearchQuery::COMPARATOR_LESS : 0)
| ($param[0] === '>' ? SearchQuery::COMPARATOR_MORE : 0)
| ($orEquals ? SearchQuery::COMPARATOR_EQUAL : 0)
);
}
$query->addDuedate(new DateQueryParameter('date', $comparator, $this->removeQuotes($value)));
Expand Down
4 changes: 2 additions & 2 deletions lib/Search/Query/AQueryParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class AQueryParameter {
protected $comparator;
/** @var mixed */
protected $value;

public function getValue() {
if (is_string($this->value) && mb_strlen($this->value) > 1) {
$param = (mb_substr($this->value, 0, 1) === '"' && mb_substr($this->value, -1, 1) === '"') ? mb_substr($this->value, 1, -1): $this->value;
return $param;
}
return $this->value;
}

public function getComparator(): int {
return $this->comparator;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Search/Query/SearchQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

class SearchQuery {
public const COMPARATOR_EQUAL = 1;

public const COMPARATOR_LESS = 2;
public const COMPARATOR_MORE = 4;

public const COMPARATOR_LESS_EQUAL = 3;
public const COMPARATOR_MORE_EQUAL = 5;

Expand All @@ -42,11 +42,11 @@ public function addTextToken(string $textToken): void {
public function getTextTokens(): array {
return $this->textTokens;
}

public function addTitle(StringQueryParameter $title): void {
$this->title[] = $title;
}

public function getTitle(): array {
return $this->title;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Search/Query/StringQueryParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
namespace OCA\Deck\Search\Query;

class StringQueryParameter extends AQueryParameter {

/** @var string */
protected $value;

public function __construct(string $field, int $comparator, string $value) {
$this->field = $field;
$this->comparator = $comparator;
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/CardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ public function update(int $id, string $title, int $stackId, string $type, strin
$card->setDuedate($duedate ? new \DateTime($duedate) : null);
$resetDuedateNotification = false;
if (
$card->getDuedate() === null ||
($card->getDuedate()) != ($changes->getBefore()->getDuedate())
$card->getDuedate() === null
|| ($card->getDuedate()) != ($changes->getBefore()->getDuedate())
) {
$card->setNotified(false);
$resetDuedateNotification = true;
Expand Down
6 changes: 5 additions & 1 deletion lib/Service/FilesAppService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use OCA\Deck\StatusException;
use OCP\AppFramework\Http\StreamResponse;
use OCP\Constants;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IFilenameValidator;
use OCP\Files\IMimeTypeDetector;
Expand Down Expand Up @@ -166,7 +167,7 @@ public function display(Attachment $attachment) {
throw new NotFoundException('File not found');
}
$file = $share->getNode();
if ($file === null || $share->getSharedWith() !== (string)$attachment->getCardId()) {
if (!($file instanceof File) || $share->getSharedWith() !== (string)$attachment->getCardId()) {
throw new NotFoundException('File not found');
}

Expand Down Expand Up @@ -262,6 +263,9 @@ private function getUploadedFile() {
public function update(Attachment $attachment) {
$share = $this->getShareForAttachment($attachment);
$target = $share->getNode();
if (!($target instanceof File)) {
throw new StatusException('Target is not a file');
}
$file = $this->getUploadedFile();
$fileName = $file['name'];
$attachment->setData($fileName);
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/Importer/BoardImportCommandService.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ protected function validateConfig(): void {
$this->getOutput()->writeln('<error>' . $e->getMessage() . '</error>');
$helper = $this->getCommand()->getHelper('question');
$question = new Question(
"<info>You can get more info on https://deck.readthedocs.io/en/latest/User_documentation_en/#6-import-boards</info>\n" .
'Please provide a valid config json file: ',
"<info>You can get more info on https://deck.readthedocs.io/en/latest/User_documentation_en/#6-import-boards</info>\n"
. 'Please provide a valid config json file: ',
'config.json'
);
$question->setValidator(function (string $answer) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Service/Importer/Systems/TrelloJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ function (\stdClass $a) use ($trelloCard) {
]
);
$message = $this->l10n->t(
"This comment has more than %s characters.\n" .
"Added as an attachment to the card with name %s.\n" .
'Accessible on URL: %s.',
"This comment has more than %s characters.\n"
. "Added as an attachment to the card with name %s.\n"
. 'Accessible on URL: %s.',
[
IComment::MAX_MESSAGE_LENGTH,
'comment_' . $commentId . '.md',
Expand Down
3 changes: 2 additions & 1 deletion lib/Sharing/DeckShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCP\Constants;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\Node;
Expand Down Expand Up @@ -421,7 +422,7 @@ public function restore(IShare $share, string $recipient): IShare {

$qb->executeStatement();

return $this->getShareById((string)$share->getId(), $recipient);
return $this->getShareById($share->getId(), $recipient);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Command/UserExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function testExecute() {
$this->commentService->expects($this->exactly(count($cards) * count($stacks) * count($boards)))
->method('list')
->willReturn(new DataResponse($comments));

$this->cardMapper->expects($this->exactly(count($boards) * count($stacks)))
->method('findAllByStack')
->willReturn($cards);
Expand Down Expand Up @@ -197,7 +197,7 @@ public function testExecuteWithDeletedCard() {
$this->commentService->expects($this->exactly(count($stacks) * count($boards)))
->method('list')
->willReturn(new DataResponse($comments));

$this->cardMapper->expects($this->once())
->method('findAllByStack')
->willReturn($cards);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Db/RelationalEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testRelation() {
$entity->setFoo('test');
$this->assertEquals([], $entity->getUpdatedFields());
}

public function testWithoutRelation() {
$entity = new MyRelationalEntity();
$entity->setFoo(null);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Service/FileServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class FileServiceTest extends TestCase {
private AttachmentMapper&MockObject $attachmentMapper;
private IMimeTypeDetector&MockObject $mimeTypeDetector;
private FileService $fileService;

public function setUp(): void {
parent::setUp();
$this->request = $this->createMock(IRequest::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Service/FilesAppServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function setUp(): void {

public function testCreateWithInvalidFilename() {
$this->expectException(BadRequestException::class);

$attachment = new Attachment();
$attachment->setCardId(123);

Expand Down
Loading