summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Comments/EntityCollection.php7
-rw-r--r--apps/dav/lib/Controller/InvitationResponseController.php19
-rw-r--r--apps/dav/templates/schedule-response-options.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php15
-rw-r--r--apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php14
-rw-r--r--apps/files/js/files.js36
-rw-r--r--core/Controller/ClientFlowLoginV2Controller.php2
-rw-r--r--lib/private/Collaboration/Reference/LinkReferenceProvider.php16
-rw-r--r--lib/private/legacy/OC_Helper.php6
9 files changed, 60 insertions, 59 deletions
diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php
index 164c690afd0..2581ff0c367 100644
--- a/apps/dav/lib/Comments/EntityCollection.php
+++ b/apps/dav/lib/Comments/EntityCollection.php
@@ -162,12 +162,9 @@ class EntityCollection extends RootCollection implements IProperties {
/**
* Sets the read marker to the specified date for the logged in user
- *
- * @param \DateTime $value
- * @return bool
*/
- public function setReadMarker($value) {
- $dateTime = new \DateTime($value);
+ public function setReadMarker(?string $value): bool {
+ $dateTime = new \DateTime($value ?? 'now');
$user = $this->userSession->getUser();
$this->commentsManager->setReadMark($this->name, $this->id, $dateTime, $user);
return true;
diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php
index de22e3ba6a9..a3607949874 100644
--- a/apps/dav/lib/Controller/InvitationResponseController.php
+++ b/apps/dav/lib/Controller/InvitationResponseController.php
@@ -140,15 +140,13 @@ class InvitationResponseController extends Controller {
*/
public function processMoreOptionsResult(string $token):TemplateResponse {
$partstat = $this->request->getParam('partStat');
- $guests = (int) $this->request->getParam('guests');
- $comment = $this->request->getParam('comment');
$row = $this->getTokenInformation($token);
if (!$row || !\in_array($partstat, ['ACCEPTED', 'DECLINED', 'TENTATIVE'])) {
return new TemplateResponse($this->appName, 'schedule-response-error', [], 'guest');
}
- $iTipMessage = $this->buildITipResponse($row, $partstat, $guests, $comment);
+ $iTipMessage = $this->buildITipResponse($row, $partstat);
$this->responseServer->handleITipMessage($iTipMessage);
if ($iTipMessage->getScheduleStatus() === '1.2') {
return new TemplateResponse($this->appName, 'schedule-response-success', [], 'guest');
@@ -190,8 +188,7 @@ class InvitationResponseController extends Controller {
* @param string|null $comment
* @return Message
*/
- private function buildITipResponse(array $row, string $partStat, int $guests = null,
- string $comment = null):Message {
+ private function buildITipResponse(array $row, string $partStat):Message {
$iTipMessage = new Message();
$iTipMessage->uid = $row['uid'];
$iTipMessage->component = 'VEVENT';
@@ -225,19 +222,7 @@ EOF;
$row['uid'], $row['sequence'] ?? 0, $row['recurrenceid'] ?? ''
]));
$vEvent = $vObject->{'VEVENT'};
- /** @var \Sabre\VObject\Property\ICalendar\CalAddress $attendee */
- $attendee = $vEvent->{'ATTENDEE'};
-
$vEvent->DTSTAMP = date('Ymd\\THis\\Z', $this->timeFactory->getTime());
-
- if ($comment) {
- $attendee->add('X-RESPONSE-COMMENT', $comment);
- $vEvent->add('COMMENT', $comment);
- }
- if ($guests) {
- $attendee->add('X-NUM-GUESTS', $guests);
- }
-
$iTipMessage->message = $vObject;
return $iTipMessage;
diff --git a/apps/dav/templates/schedule-response-options.php b/apps/dav/templates/schedule-response-options.php
index fe12ea96c79..bae43022f12 100644
--- a/apps/dav/templates/schedule-response-options.php
+++ b/apps/dav/templates/schedule-response-options.php
@@ -25,10 +25,6 @@
</label>
</div>
</fieldset>
- <fieldset id="more_options">
- <input type="number" min="0" name="guests" placeholder="<?php p($l->t('Number of guests')); ?>" />
- <input type="text" name="comment" placeholder="<?php p($l->t('Comment')); ?>" />
- </fieldset>
<fieldset>
<input type="submit" value="<?php p($l->t('Save'));?>">
</fieldset>
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index e8297c2ac66..1de82484ac4 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -34,6 +34,7 @@ use OC\Files\Storage\Wrapper\Quota;
use OCA\DAV\Connector\Sabre\Directory;
use OCP\Files\ForbiddenException;
use OCP\Files\Mount\IMountPoint;
+use Test\Traits\UserTrait;
class TestViewDirectory extends \OC\Files\View {
private $updatables;
@@ -73,6 +74,8 @@ class TestViewDirectory extends \OC\Files\View {
*/
class DirectoryTest extends \Test\TestCase {
+ use UserTrait;
+
/** @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject */
private $view;
/** @var \OC\Files\FileInfo | \PHPUnit\Framework\MockObject\MockObject */
@@ -274,6 +277,8 @@ class DirectoryTest extends \Test\TestCase {
}
public function testGetQuotaInfoUnlimited() {
+ self::createUser('user', 'password');
+ self::loginAsUser('user');
$mountPoint = $this->createMock(IMountPoint::class);
$storage = $this->getMockBuilder(Quota::class)
->disableOriginalConstructor()
@@ -288,6 +293,10 @@ class DirectoryTest extends \Test\TestCase {
'\OC\Files\Storage\Wrapper\Quota' => false,
]);
+ $storage->expects($this->once())
+ ->method('getOwner')
+ ->willReturn('user');
+
$storage->expects($this->never())
->method('getQuota');
@@ -311,6 +320,8 @@ class DirectoryTest extends \Test\TestCase {
}
public function testGetQuotaInfoSpecific() {
+ self::createUser('user', 'password');
+ self::loginAsUser('user');
$mountPoint = $this->createMock(IMountPoint::class);
$storage = $this->getMockBuilder(Quota::class)
->disableOriginalConstructor()
@@ -326,6 +337,10 @@ class DirectoryTest extends \Test\TestCase {
]);
$storage->expects($this->once())
+ ->method('getOwner')
+ ->willReturn('user');
+
+ $storage->expects($this->once())
->method('getQuota')
->willReturn(1000);
diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
index 576fde2d4af..abeff5473ad 100644
--- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
+++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
@@ -381,18 +381,10 @@ EOF;
* @dataProvider attendeeProvider
*/
public function testProcessMoreOptionsResult(bool $isExternalAttendee): void {
- $this->request->expects($this->at(0))
+ $this->request->expects($this->once())
->method('getParam')
->with('partStat')
->willReturn('TENTATIVE');
- $this->request->expects($this->at(1))
- ->method('getParam')
- ->with('guests')
- ->willReturn('7');
- $this->request->expects($this->at(2))
- ->method('getParam')
- ->with('comment')
- ->willReturn('Foo bar Bli blub');
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@@ -411,14 +403,12 @@ VERSION:2.0
PRODID:-//Nextcloud/Nextcloud CalDAV Server//EN
METHOD:REPLY
BEGIN:VEVENT
-ATTENDEE;PARTSTAT=TENTATIVE;X-RESPONSE-COMMENT=Foo bar Bli blub;X-NUM-GUEST
- S=7:mailto:attendee@foo.bar
+ATTENDEE;PARTSTAT=TENTATIVE:mailto:attendee@foo.bar
ORGANIZER:mailto:organizer@foo.bar
UID:this-is-the-events-uid
SEQUENCE:0
REQUEST-STATUS:2.0;Success
DTSTAMP:19700101T002217Z
-COMMENT:Foo bar Bli blub
END:VEVENT
END:VCALENDAR
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index a14afcd4fce..0ae049360b4 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -449,7 +449,6 @@ var dragOptions={
revert: 'invalid',
revertDuration: 300,
opacity: 0.7,
- appendTo: 'body',
cursorAt: { left: 24, top: 18 },
helper: createDragShadow,
cursor: 'move',
@@ -482,23 +481,26 @@ var dragOptions={
$('.crumbmenu').removeClass('canDropChildren');
},
drag: function(event, ui) {
- var scrollingArea = FileList.$container;
- var currentScrollTop = $(scrollingArea).scrollTop();
- var scrollArea = Math.min(Math.floor($(window).innerHeight() / 2), 100);
-
- var bottom = $(window).innerHeight() - scrollArea;
- var top = $(window).scrollTop() + scrollArea;
- if (event.pageY < top) {
- $(scrollingArea).animate({
- scrollTop: currentScrollTop - 10
- }, 400);
-
- } else if (event.pageY > bottom) {
- $(scrollingArea).animate({
- scrollTop: currentScrollTop + 10
- }, 400);
- }
+ /** @type {JQuery<HTMLDivElement>} */
+ const scrollingArea = FileList.$container;
+
+ // Get the top and bottom scroll trigger y positions
+ const containerHeight = scrollingArea.innerHeight() ?? 0
+ const scrollTriggerArea = Math.min(Math.floor(containerHeight / 2), 100);
+ const bottomTriggerY = containerHeight - scrollTriggerArea;
+ const topTriggerY = scrollTriggerArea;
+
+ // Get the cursor position relative to the container
+ const containerOffset = scrollingArea.offset() ?? {left: 0, top: 0}
+ const cursorPositionY = event.pageY - containerOffset.top
+ const currentScrollTop = scrollingArea.scrollTop() ?? 0
+
+ if (cursorPositionY < topTriggerY) {
+ scrollingArea.scrollTop(currentScrollTop - 10)
+ } else if (cursorPositionY > bottomTriggerY) {
+ scrollingArea.scrollTop(currentScrollTop + 10)
+ }
}
};
// sane browsers support using the distance option
diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php
index 3c57b190593..4df94a28d6a 100644
--- a/core/Controller/ClientFlowLoginV2Controller.php
+++ b/core/Controller/ClientFlowLoginV2Controller.php
@@ -216,7 +216,7 @@ class ClientFlowLoginV2Controller extends Controller {
return $response;
}
- $result = $this->loginFlowV2Service->flowDoneWithAppPassword($loginToken, $this->getServerPath(), $this->userId, $password);
+ $result = $this->loginFlowV2Service->flowDoneWithAppPassword($loginToken, $this->getServerPath(), $token->getLoginName(), $password);
return $this->handleFlowDone($result);
}
diff --git a/lib/private/Collaboration/Reference/LinkReferenceProvider.php b/lib/private/Collaboration/Reference/LinkReferenceProvider.php
index 5597df1ca97..583cbdcfe99 100644
--- a/lib/private/Collaboration/Reference/LinkReferenceProvider.php
+++ b/lib/private/Collaboration/Reference/LinkReferenceProvider.php
@@ -105,6 +105,22 @@ class LinkReferenceProvider implements IReferenceProvider {
$client = $this->clientService->newClient();
try {
+ $headResponse = $client->head($reference->getId(), [ 'timeout' => 10 ]);
+ } catch (\Exception $e) {
+ $this->logger->debug('Failed to perform HEAD request to get target metadata', ['exception' => $e]);
+ return;
+ }
+ $linkContentLength = $headResponse->getHeader('Content-Length');
+ if (is_numeric($linkContentLength) && (int) $linkContentLength > 5 * 1024 * 1024) {
+ $this->logger->debug('Skip resolving links pointing to content length > 5 MB');
+ return;
+ }
+ $linkContentType = $headResponse->getHeader('Content-Type');
+ if ($linkContentType !== 'text/html') {
+ $this->logger->debug('Skip resolving links pointing to content type that is not "text/html"');
+ return;
+ }
+ try {
$response = $client->get($reference->getId(), [ 'timeout' => 10 ]);
} catch (\Exception $e) {
$this->logger->debug('Failed to fetch link for obtaining open graph data', ['exception' => $e]);
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php
index de42a7bc7fc..5ee6ec69ac2 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -547,10 +547,10 @@ class OC_Helper {
$ownerId = $storage->getOwner($path);
$ownerDisplayName = '';
- $owner = \OC::$server->getUserManager()->get($ownerId);
- if ($owner) {
- $ownerDisplayName = $owner->getDisplayName();
+ if ($ownerId) {
+ $ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? '';
}
+
if (substr_count($mount->getMountPoint(), '/') < 3) {
$mountPoint = '';
} else {