Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/dav/upcoming-e…
Browse files Browse the repository at this point in the history
…vents-api
  • Loading branch information
ChristophWurst committed Aug 13, 2024
2 parents 6965ba0 + cee227a commit 4d56826
Show file tree
Hide file tree
Showing 966 changed files with 8,190 additions and 4,230 deletions.
2 changes: 1 addition & 1 deletion apps/admin_audit/l10n/es_MX.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ OC.L10N.register(
"admin_audit",
{
"Auditing / Logging" : "Auditoría / Registros",
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Habilita las opciones de bitácora de Nextcloud tales como registro de acceso a archivos o de acciones delicadas."
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, tales como el registro de accesos a archivos o de acciones delicadas."
},
"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;");
2 changes: 1 addition & 1 deletion apps/admin_audit/l10n/es_MX.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ "translations": {
"Auditing / Logging" : "Auditoría / Registros",
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Habilita las opciones de bitácora de Nextcloud tales como registro de acceso a archivos o de acciones delicadas."
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, tales como el registro de accesos a archivos o de acciones delicadas."
},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"
}
6 changes: 4 additions & 2 deletions apps/admin_audit/lib/Actions/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace OCA\AdminAudit\Actions;

use OC\Files\Node\NonExistingFile;
use OCP\Files\Events\Node\BeforeNodeReadEvent;
use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
use OCP\Files\Events\Node\BeforeNodeWrittenEvent;
Expand Down Expand Up @@ -35,9 +36,10 @@ class Files extends Action {
*/
public function read(BeforeNodeReadEvent $event): void {
try {
$node = $event->getNode();
$params = [
'id' => $event->getNode()->getId(),
'path' => mb_substr($event->getNode()->getInternalPath(), 5),
'id' => $node instanceof NonExistingFile ? null : $node->getId(),
'path' => mb_substr($node->getInternalPath(), 5),
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
Expand Down
4 changes: 4 additions & 0 deletions apps/comments/l10n/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ OC.L10N.register(
"{author} commented on {file}" : "{author} hozzászólt ehhez: {file}",
"<strong>Comments</strong> for files" : "<strong>Hozzászólások</strong> fájlokhoz",
"Files" : "Fájlok",
"You were mentioned on \"{file}\", in a comment by an account that has since been deleted" : "Megemlítették ennél: „{file}”, egy már törölt fiók hozzászólásában",
"{user} mentioned you in a comment on \"{file}\"" : "{user} megemlítette egy hozzászólásban ennél: „{file}”",
"Files app plugin to add comments to files" : "A Fájlok alkalmazás bővítménye, amellyel megjegyzések adhatóak a fájlokhoz",
"Edit comment" : "Hozzászólás szerkesztése",
"Delete comment" : "Hozzászólás törlése",
"Cancel edit" : "Változások elvetése",
"New comment" : "Új hozzászólás",
"Write a comment …" : "Hozzászólás írása…",
"Post comment" : "Hozzászólás közzététele",
"@ for mentions, : for emoji, / for smart picker" : "@ az említésekhez, : az emodzsikhoz, / az okos választóhoz",
"Could not reload comments" : "Nem sikerült a megjegyzések újratöltése.",
Expand All @@ -30,6 +33,7 @@ OC.L10N.register(
"An error occurred while trying to delete the comment" : "Hiba történt a megjegyzés törlése közben",
"An error occurred while trying to create the comment" : "Hiba történt a megjegyzés létrehozása közben",
"You were mentioned on \"{file}\", in a comment by a user that has since been deleted" : "Megemlítették ennél: „{file}”, egy már törölt felhasználó hozzászólásában",
"Write a message …" : "Üzenet írása…",
"\"@\" for mentions, \":\" for emoji, \"/\" for smart picker" : "„@” az említésekhez, „:” az emodzsikhoz, „/” az okos választához",
"_%n unread comment_::_%n unread comments_" : ["%n olvasatlan hozzászólás","%n olvasatlan hozzászólás"]
},
Expand Down
4 changes: 4 additions & 0 deletions apps/comments/l10n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
"{author} commented on {file}" : "{author} hozzászólt ehhez: {file}",
"<strong>Comments</strong> for files" : "<strong>Hozzászólások</strong> fájlokhoz",
"Files" : "Fájlok",
"You were mentioned on \"{file}\", in a comment by an account that has since been deleted" : "Megemlítették ennél: „{file}”, egy már törölt fiók hozzászólásában",
"{user} mentioned you in a comment on \"{file}\"" : "{user} megemlítette egy hozzászólásban ennél: „{file}”",
"Files app plugin to add comments to files" : "A Fájlok alkalmazás bővítménye, amellyel megjegyzések adhatóak a fájlokhoz",
"Edit comment" : "Hozzászólás szerkesztése",
"Delete comment" : "Hozzászólás törlése",
"Cancel edit" : "Változások elvetése",
"New comment" : "Új hozzászólás",
"Write a comment …" : "Hozzászólás írása…",
"Post comment" : "Hozzászólás közzététele",
"@ for mentions, : for emoji, / for smart picker" : "@ az említésekhez, : az emodzsikhoz, / az okos választóhoz",
"Could not reload comments" : "Nem sikerült a megjegyzések újratöltése.",
Expand All @@ -28,6 +31,7 @@
"An error occurred while trying to delete the comment" : "Hiba történt a megjegyzés törlése közben",
"An error occurred while trying to create the comment" : "Hiba történt a megjegyzés létrehozása közben",
"You were mentioned on \"{file}\", in a comment by a user that has since been deleted" : "Megemlítették ennél: „{file}”, egy már törölt felhasználó hozzászólásában",
"Write a message …" : "Üzenet írása…",
"\"@\" for mentions, \":\" for emoji, \"/\" for smart picker" : "„@” az említésekhez, „:” az emodzsikhoz, „/” az okos választához",
"_%n unread comment_::_%n unread comments_" : ["%n olvasatlan hozzászólás","%n olvasatlan hozzászólás"]
},"pluralForm" :"nplurals=2; plural=(n != 1);"
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/img/dashboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/dashboard/img/dashboard.svg.license
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SPDX-FileCopyrightText: 2018-2024 Google LLC
SPDX-License-Identifier: Apache-2.0

Source: Material Symbols icon "dashboard"
Source: Material Symbols icon "View Column"
7 changes: 7 additions & 0 deletions apps/dav/appinfo/v2/publicremote.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\View;
use OCA\DAV\Storage\PublicOwnerWrapper;
use OCA\DAV\Storage\PublicShareWrapper;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Mount\IMountManager;
Expand Down Expand Up @@ -98,6 +99,12 @@
return new PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]);
});

// Ensure that also private shares have the `getShare` method
/** @psalm-suppress MissingClosureParamType */
Filesystem::addStorageWrapper('getShare', function ($mountPoint, $storage) use ($share) {
return new PublicShareWrapper(['storage' => $storage, 'share' => $share]);
}, 0);

/** @psalm-suppress InternalMethod */
Filesystem::logWarningWhenAddingStorageWrapper($previousLog);

Expand Down
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@
'OCA\\DAV\\SetupChecks\\NeedsSystemAddressBookSync' => $baseDir . '/../lib/SetupChecks/NeedsSystemAddressBookSync.php',
'OCA\\DAV\\SetupChecks\\WebdavEndpoint' => $baseDir . '/../lib/SetupChecks/WebdavEndpoint.php',
'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir . '/../lib/Storage/PublicOwnerWrapper.php',
'OCA\\DAV\\Storage\\PublicShareWrapper' => $baseDir . '/../lib/Storage/PublicShareWrapper.php',
'OCA\\DAV\\SystemTag\\SystemTagList' => $baseDir . '/../lib/SystemTag/SystemTagList.php',
'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir . '/../lib/SystemTag/SystemTagMappingNode.php',
'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir . '/../lib/SystemTag/SystemTagNode.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\SetupChecks\\NeedsSystemAddressBookSync' => __DIR__ . '/..' . '/../lib/SetupChecks/NeedsSystemAddressBookSync.php',
'OCA\\DAV\\SetupChecks\\WebdavEndpoint' => __DIR__ . '/..' . '/../lib/SetupChecks/WebdavEndpoint.php',
'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__ . '/..' . '/../lib/Storage/PublicOwnerWrapper.php',
'OCA\\DAV\\Storage\\PublicShareWrapper' => __DIR__ . '/..' . '/../lib/Storage/PublicShareWrapper.php',
'OCA\\DAV\\SystemTag\\SystemTagList' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagList.php',
'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagMappingNode.php',
'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagNode.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/l10n/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ OC.L10N.register(
"Delete slot" : "Idősáv törlése",
"No working hours set" : "Nincs munkaidő beállítva",
"Add slot" : "Idősáv hozzáadása",
"Weekdays" : "Hétköznapok",
"Automatically set user status to \"Do not disturb\" outside of availability to mute all notifications." : "Az elérhetőségi időn túl, a felhasználói állapot automatikus beállítása „Ne zavarjanak” módba az összes értesítés némításához.",
"Failed to load availability" : "Az elérhetőség betöltése sikertelen",
"Saved availability" : "Elérhetőség mentve",
Expand Down
1 change: 1 addition & 0 deletions apps/dav/l10n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"Delete slot" : "Idősáv törlése",
"No working hours set" : "Nincs munkaidő beállítva",
"Add slot" : "Idősáv hozzáadása",
"Weekdays" : "Hétköznapok",
"Automatically set user status to \"Do not disturb\" outside of availability to mute all notifications." : "Az elérhetőségi időn túl, a felhasználói állapot automatikus beállítása „Ne zavarjanak” módba az összes értesítés némításához.",
"Failed to load availability" : "Az elérhetőség betöltése sikertelen",
"Saved availability" : "Elérhetőség mentve",
Expand Down
99 changes: 41 additions & 58 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -2410,74 +2410,57 @@ public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limi
);
$stmt = $qb->executeQuery();
$currentToken = $stmt->fetchOne();
$initialSync = !is_numeric($syncToken);

if ($currentToken === false) {
return null;
}

$result = [
'syncToken' => $currentToken,
'added' => [],
'modified' => [],
'deleted' => [],
];

if ($syncToken) {
$qb = $this->db->getQueryBuilder();

$qb->select('uri', 'operation')
->from('calendarchanges')
->where(
$qb->expr()->andX(
$qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)),
$qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)),
$qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
$qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
)
)->orderBy('synctoken');
if (is_int($limit) && $limit > 0) {
$qb->setMaxResults($limit);
}

// Fetching all changes
$stmt = $qb->executeQuery();
$changes = [];

// This loop ensures that any duplicates are overwritten, only the
// last change on a node is relevant.
while ($row = $stmt->fetch()) {
$changes[$row['uri']] = $row['operation'];
}
$stmt->closeCursor();

foreach ($changes as $uri => $operation) {
switch ($operation) {
case 1:
$result['added'][] = $uri;
break;
case 2:
$result['modified'][] = $uri;
break;
case 3:
$result['deleted'][] = $uri;
break;
}
}
} else {
// No synctoken supplied, this is the initial sync.
// evaluate if this is a initial sync and construct appropriate command
if ($initialSync) {
$qb = $this->db->getQueryBuilder();
$qb->select('uri')
->from('calendarobjects')
->where(
$qb->expr()->andX(
$qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
$qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
)
);
$stmt = $qb->executeQuery();
->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
->andWhere($qb->expr()->isNull('deleted_at'));
} else {
$qb = $this->db->getQueryBuilder();
$qb->select('uri', $qb->func()->max('operation'))
->from('calendarchanges')
->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
->andWhere($qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)))
->andWhere($qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)))
->groupBy('uri');
}
// evaluate if limit exists
if (is_numeric($limit)) {
$qb->setMaxResults($limit);
}
// execute command
$stmt = $qb->executeQuery();
// build results
$result = ['syncToken' => $currentToken, 'added' => [], 'modified' => [], 'deleted' => []];
// retrieve results
if ($initialSync) {
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
$stmt->closeCursor();
} else {
// \PDO::FETCH_NUM is needed due to the inconsistent field names
// produced by doctrine for MAX() with different databases
while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) {
// assign uri (column 0) to appropriate mutation based on operation (column 1)
// forced (int) is needed as doctrine with OCI returns the operation field as string not integer
match ((int)$entry[1]) {
1 => $result['added'][] = $entry[0],
2 => $result['modified'][] = $entry[0],
3 => $result['deleted'][] = $entry[0],
default => $this->logger->debug('Unknown calendar change operation detected')
};
}
}
$stmt->closeCursor();

return $result;
}, $this->db);
}
Expand Down
5 changes: 3 additions & 2 deletions apps/dav/lib/CalDAV/Reminder/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ public function __construct(IDBConnection $db,
*/
public function getRemindersToProcess():array {
$query = $this->db->getQueryBuilder();
$query->select(['cr.*', 'co.calendardata', 'c.displayname', 'c.principaluri'])
$query->select(['cr.*', 'co.calendardata', 'c.displayname', 'c.principaluri','cr.notification_date', 'cr.event_hash', 'cr.type'])
->from('calendar_reminders', 'cr')
->where($query->expr()->lte('cr.notification_date', $query->createNamedParameter($this->timeFactory->getTime())))
->join('cr', 'calendarobjects', 'co', $query->expr()->eq('cr.object_id', 'co.id'))
->join('cr', 'calendars', 'c', $query->expr()->eq('cr.calendar_id', 'c.id'));
->join('cr', 'calendars', 'c', $query->expr()->eq('cr.calendar_id', 'c.id'))
->groupBy('cr.event_hash', 'cr.notification_date', 'cr.type');
$stmt = $query->execute();

return array_map(
Expand Down
9 changes: 8 additions & 1 deletion apps/dav/lib/CalDAV/Reminder/ReminderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,14 @@ private function getRemindersForVAlarm(VAlarm $valarm,
* @param array $reminders
*/
private function writeRemindersToDatabase(array $reminders): void {
$uniqueReminders = [];
foreach ($reminders as $reminder) {
$key = $reminder['notification_date']. $reminder['event_hash'].$reminder['type'];
if(!isset($uniqueReminders[$key])) {
$uniqueReminders[$key] = $reminder;
}
}
foreach (array_values($uniqueReminders) as $reminder) {
$this->backend->insertReminder(
(int) $reminder['calendar_id'],
(int) $reminder['object_id'],
Expand Down Expand Up @@ -847,7 +854,7 @@ private function isRecurring(VEvent $vevent):bool {
private function getCalendarTimeZone(int $calendarid): DateTimeZone {
$calendarInfo = $this->caldavBackend->getCalendarById($calendarid);
$tzProp = '{urn:ietf:params:xml:ns:caldav}calendar-timezone';
if (!isset($calendarInfo[$tzProp])) {
if (empty($calendarInfo[$tzProp])) {
// Defaulting to UTC
return new DateTimeZone('UTC');
}
Expand Down
39 changes: 38 additions & 1 deletion apps/dav/lib/CalDAV/Schedule/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,42 @@ public function calendarObjectChange(RequestInterface $request, ResponseInterfac
}

try {
parent::calendarObjectChange($request, $response, $vCal, $calendarPath, $modified, $isNew);

if (!$this->scheduleReply($this->server->httpRequest)) {
return;
}

/** @var \OCA\DAV\CalDAV\Calendar $calendarNode */
$calendarNode = $this->server->tree->getNodeForPath($calendarPath);
// extract addresses for owner
$addresses = $this->getAddressesForPrincipal($calendarNode->getOwner());
// determain if request is from a sharee
if ($calendarNode->isShared()) {
// extract addresses for sharee and add to address collection
$addresses = array_merge(
$addresses,
$this->getAddressesForPrincipal($calendarNode->getPrincipalURI())
);
}
// determine if we are updating a calendar event
if (!$isNew) {
// retrieve current calendar event node
/** @var \OCA\DAV\CalDAV\CalendarObject $currentNode */
$currentNode = $this->server->tree->getNodeForPath($request->getPath());
// convert calendar event string data to VCalendar object
/** @var \Sabre\VObject\Component\VCalendar $currentObject */
$currentObject = Reader::read($currentNode->get());
} else {
$currentObject = null;
}
// process request
$this->processICalendarChange($currentObject, $vCal, $addresses, [], $modified);

if ($currentObject) {
// Destroy circular references so PHP will GC the object.
$currentObject->destroy();
}

} catch (SameOrganizerForAllComponentsException $e) {
$this->handleSameOrganizerException($e, $vCal, $calendarPath);
}
Expand Down Expand Up @@ -526,7 +561,9 @@ private function isAvailableAtTime(string $email, \DateTimeInterface $start, \Da
$calendarTimeZone = new DateTimeZone('UTC');

$homePath = $result[0][200]['{' . self::NS_CALDAV . '}calendar-home-set']->getHref();
/** @var \OCA\DAV\CalDAV\Calendar $node */
foreach ($this->server->tree->getNodeForPath($homePath)->getChildren() as $node) {

if (!$node instanceof ICalendar) {
continue;
}
Expand Down
6 changes: 5 additions & 1 deletion apps/dav/lib/CalDAV/WebcalCaching/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ class Plugin extends ServerPlugin {
* that do not support subscriptions on their own
*
* /^MSFT-WIN-3/ - Windows 10 Calendar
* /Evolution/ - Gnome Calendar/Evolution
* /KIO/ - KDE PIM/Akonadi
* @var string[]
*/
public const ENABLE_FOR_CLIENTS = [
"/^MSFT-WIN-3/"
"/^MSFT-WIN-3/",
"/Evolution/",
"/KIO/"
];

/**
Expand Down
9 changes: 3 additions & 6 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,14 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
return $node->getNode()->getInternalPath() === '' ? 'true' : 'false';
});

$propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest): ?string {
$propFind->handle(self::SHARE_NOTE, function () use ($node): ?string {
$user = $this->userSession->getUser();
if ($user === null) {
return null;
}
return $node->getNoteFromShare(
$user->getUID()
$user?->getUID()
);
});

$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () use ($node) {
$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () {
return $this->config->getSystemValue('data-fingerprint', '');
});
$propFind->handle(self::CREATIONDATE_PROPERTYNAME, function () use ($node) {
Expand Down
Loading

0 comments on commit 4d56826

Please sign in to comment.