@@ -114,7 +114,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
|
||||
try {
|
||||
$board = $this->boardMapper->find($boardId);
|
||||
$valid &= !$board->getArchived();
|
||||
$valid = $valid && !$board->getArchived();
|
||||
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
|
||||
$valid = false;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
*/
|
||||
private function createShareObject(array $data): IShare {
|
||||
$share = $this->shareManager->newShare();
|
||||
$share->setId((int)$data['id'])
|
||||
$share->setId($data['id'])
|
||||
->setShareType((int)$data['share_type'])
|
||||
->setPermissions((int)$data['permissions'])
|
||||
->setTarget($data['file_target'])
|
||||
@@ -401,7 +401,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
|
||||
$qb->execute();
|
||||
|
||||
return $this->getShareById($share->getId(), $recipient);
|
||||
return $this->getShareById((int)$share->getId(), $recipient);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -456,6 +456,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @returns
|
||||
*/
|
||||
public function getSharesInFolder($userId, Folder $node, $reshares) {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
@@ -755,14 +756,13 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
/**
|
||||
* Get shared with the card
|
||||
*
|
||||
* @param string $userId get shares where this user is the recipient
|
||||
* @param int $cardId
|
||||
* @param int $shareType
|
||||
* @param Node|null $node
|
||||
* @param int $limit The max number of entries returned, -1 for all
|
||||
* @param int $offset
|
||||
* @return IShare[]
|
||||
*/
|
||||
public function getSharedWithByType(string $cardId, int $shareType, $limit, $offset): array {
|
||||
public function getSharedWithByType(int $cardId, int $shareType, $limit, $offset): array {
|
||||
/** @var IShare[] $shares */
|
||||
$shares = [];
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ use OCA\Deck\NoPermissionException;
|
||||
use OCA\Deck\Service\PermissionService;
|
||||
use OCP\AppFramework\OCS\OCSNotFoundException;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Share\IShare;
|
||||
|
||||
@@ -40,12 +41,14 @@ class ShareAPIHelper {
|
||||
private $timeFactory;
|
||||
private $cardMapper;
|
||||
private $permissionService;
|
||||
private $l10n;
|
||||
|
||||
public function __construct(IURLGenerator $urlGenerator, ITimeFactory $timeFactory, CardMapper $cardMapper, PermissionService $permissionService) {
|
||||
public function __construct(IURLGenerator $urlGenerator, ITimeFactory $timeFactory, CardMapper $cardMapper, PermissionService $permissionService, IL10N $l10n) {
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->cardMapper = $cardMapper;
|
||||
$this->permissionService = $permissionService;
|
||||
$this->l10n = $l10n;
|
||||
}
|
||||
|
||||
public function formatShare(IShare $share): array {
|
||||
@@ -67,7 +70,7 @@ class ShareAPIHelper {
|
||||
$expireDate = $this->parseDate($expireDate);
|
||||
$share->setExpirationDate($expireDate);
|
||||
} catch (\Exception $e) {
|
||||
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD'));
|
||||
throw new OCSNotFoundException($this->l10n->t('Invalid date, date format must be YYYY-MM-DD'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,10 +93,6 @@ class ShareAPIHelper {
|
||||
throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
|
||||
}
|
||||
|
||||
if ($date === false) {
|
||||
throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
|
||||
}
|
||||
|
||||
$date->setTime(0, 0, 0);
|
||||
|
||||
return $date;
|
||||
|
||||
Reference in New Issue
Block a user