diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/DAV/CustomPropertiesBackend.php | 6 | ||||
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 13 | ||||
-rw-r--r-- | apps/files_sharing/lib/Capabilities.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/tests/CapabilitiesTest.php | 34 | ||||
-rw-r--r-- | apps/settings/lib/Settings/Admin/Sharing.php | 2 | ||||
-rw-r--r-- | apps/settings/tests/Settings/Admin/SharingTest.php | 4 | ||||
-rw-r--r-- | apps/theming/css/default.css | 4 | ||||
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 4 |
8 files changed, 49 insertions, 23 deletions
diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index 177236a2f4e..f9a4f8ee986 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -10,6 +10,7 @@ namespace OCA\DAV\DAV; use Exception; use OCA\DAV\CalDAV\Calendar; +use OCA\DAV\CalDAV\CalendarObject; use OCA\DAV\CalDAV\DefaultCalendarValidator; use OCA\DAV\Connector\Sabre\Directory; use OCP\DB\QueryBuilder\IQueryBuilder; @@ -196,6 +197,11 @@ class CustomPropertiesBackend implements BackendInterface { $this->cacheDirectory($path, $node); } + if ($node instanceof CalendarObject) { + // No custom properties supported on individual events + return; + } + // First fetch the published properties (set by another user), then get the ones set by // the current user. If both are set then the latter as priority. foreach ($this->getPublishedProperties($path, $requestedProps) as $propName => $propValue) { diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 84c99f32109..afef5d2093d 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -333,15 +333,10 @@ class OwnershipTransferService { if ($path !== "$sourceUid/files") { $sharePage = array_filter($sharePage, function (IShare $share) use ($view, $normalizedPath) { try { - $relativePath = $view->getPath($share->getNodeId()); - $singleFileTranfer = $view->is_file($normalizedPath); - if ($singleFileTranfer) { - return Filesystem::normalizePath($relativePath) === $normalizedPath; - } + $sourceNode = $share->getNode(); + $relativePath = $view->getRelativePath($sourceNode->getPath()); - return mb_strpos( - Filesystem::normalizePath($relativePath . '/', false), - $normalizedPath . '/') === 0; + return str_starts_with($relativePath . '/', $normalizedPath . '/'); } catch (Exception $e) { return false; } @@ -357,7 +352,7 @@ class OwnershipTransferService { return array_values(array_filter(array_map(function (IShare $share) use ($view, $normalizedPath, $output, $sourceUid) { try { - $nodePath = $view->getPath($share->getNodeId()); + $nodePath = $view->getRelativePath($share->getNode()->getPath()); } catch (NotFoundException $e) { $output->writeln("<error>Failed to find path for shared file {$share->getNodeId()} for user $sourceUid, skipping</error>"); return null; diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php index cbb9b5cd2f2..06aa1271c8f 100644 --- a/apps/files_sharing/lib/Capabilities.php +++ b/apps/files_sharing/lib/Capabilities.php @@ -7,9 +7,11 @@ */ namespace OCA\Files_Sharing; +use OC\Core\AppInfo\ConfigLexicon; use OCP\App\IAppManager; use OCP\Capabilities\ICapability; use OCP\Constants; +use OCP\IAppConfig; use OCP\IConfig; use OCP\Share\IManager; @@ -21,6 +23,7 @@ use OCP\Share\IManager; class Capabilities implements ICapability { public function __construct( private IConfig $config, + private readonly IAppConfig $appConfig, private IManager $shareManager, private IAppManager $appManager, ) { @@ -111,7 +114,7 @@ class Capabilities implements ICapability { if ($public['password']['enforced']) { $public['password']['askForOptionalPassword'] = false; } else { - $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); + $public['password']['askForOptionalPassword'] = $this->appConfig->getValueBool('core', ConfigLexicon::SHARE_LINK_PASSWORD_DEFAULT); } $public['expire_date'] = []; diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index 2fe221703a5..9a076d7a171 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -56,11 +56,30 @@ class CapabilitiesTest extends \Test\TestCase { * @param (string[])[] $map Map of arguments to return types for the getAppValue function in the mock * @return string[] */ - private function getResults(array $map, bool $federationEnabled = true) { + private function getResults(array $map, array $typedMap = [], bool $federationEnabled = true) { $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock(); $appManager = $this->getMockBuilder(IAppManager::class)->disableOriginalConstructor()->getMock(); $config->method('getAppValue')->willReturnMap($map); $appManager->method('isEnabledForAnyone')->with('federation')->willReturn($federationEnabled); + + if (empty($typedMap)) { + $appConfig = $this->createMock(IAppConfig::class); + } else { + // hack to help transition from old IConfig to new IAppConfig + $appConfig = $this->getMockBuilder(IAppConfig::class)->disableOriginalConstructor()->getMock(); + $appConfig->expects($this->any())->method('getValueBool')->willReturnCallback(function (...$args) use ($typedMap): bool { + foreach ($typedMap as $entry) { + if ($entry[0] !== $args[0] || $entry[1] !== $args[1]) { + continue; + } + + return $entry[2]; + } + + return false; + }); + } + $shareManager = new Manager( $this->createMock(LoggerInterface::class), $config, @@ -80,9 +99,10 @@ class CapabilitiesTest extends \Test\TestCase { $this->createMock(KnownUserService::class), $this->createMock(ShareDisableChecker::class), $this->createMock(IDateTimeZone::class), - $this->createMock(IAppConfig::class), + $appConfig, ); - $cap = new Capabilities($config, $shareManager, $appManager); + + $cap = new Capabilities($config, $appConfig, $shareManager, $appManager); $result = $this->getFilesSharingPart($cap->getCapabilities()); return $result; } @@ -135,9 +155,11 @@ class CapabilitiesTest extends \Test\TestCase { ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''], - ['core', 'shareapi_enforce_links_password', 'no', 'yes'], ]; - $result = $this->getResults($map); + $typedMap = [ + ['core', 'shareapi_enforce_links_password', true], + ]; + $result = $this->getResults($map, $typedMap); $this->assertArrayHasKey('password', $result['public']); $this->assertArrayHasKey('enforced', $result['public']['password']); $this->assertTrue($result['public']['password']['enforced']); @@ -328,7 +350,7 @@ class CapabilitiesTest extends \Test\TestCase { } public function testFederatedSharingDisabled(): void { - $result = $this->getResults([], false); + $result = $this->getResults([], federationEnabled: false); $this->assertArrayHasKey('federation', $result); $this->assertFalse($result['federation']['incoming']); $this->assertFalse($result['federation']['outgoing']); diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index e038b2a6231..ec5dcdf624d 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -68,7 +68,7 @@ class Sharing implements IDelegatedSettings { 'excludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no'), 'excludeGroupsList' => json_decode($excludedGroups, true) ?? [], 'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext'), - 'enableLinkPasswordByDefault' => $this->getHumanBooleanConfig('core', 'shareapi_enable_link_password_by_default'), + 'enableLinkPasswordByDefault' => $this->appConfig->getValueBool('core', ConfigLexicon::SHARE_LINK_PASSWORD_DEFAULT), 'defaultPermissions' => (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL), 'defaultInternalExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_default_internal_expire_date'), 'internalExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'), diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index 12ab5c3cada..f37ade2171f 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -57,7 +57,8 @@ class SharingTest extends TestCase { $this->appConfig ->method('getValueBool') ->willReturnMap([ - ['core', 'shareapi_allow_federation_on_public_shares', false, false, true], + ['core', 'shareapi_allow_federation_on_public_shares', true], + ['core', 'shareapi_enable_link_password_by_default', true], ]); $this->config @@ -82,7 +83,6 @@ class SharingTest extends TestCase { ['core', 'shareapi_enforce_expire_date', 'no', 'no'], ['core', 'shareapi_exclude_groups', 'no', 'no'], ['core', 'shareapi_public_link_disclaimertext', '', 'Lorem ipsum'], - ['core', 'shareapi_enable_link_password_by_default', 'no', 'yes'], ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL], ['core', 'shareapi_default_internal_expire_date', 'no', 'no'], ['core', 'shareapi_internal_expire_after_n_days', '7', '7'], diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css index 6a6628f074a..41f0272f017 100644 --- a/apps/theming/css/default.css +++ b/apps/theming/css/default.css @@ -79,9 +79,9 @@ --header-menu-item-height: 44px; /* An alpha mask to be applied to all icons on the navigation bar (header menu). * Icons are have a size of 20px but usually we use MDI which have a content of 16px so 2px padding top bottom, - * for better gradient we set those 2px (10% of height) as start and stop positions, this is also somewhat size agnostic as we only depend on the percentage. + * for better gradient we must at first begin at those 2px (10% of height) as start and stop positions. */ - --header-menu-icon-mask: linear-gradient(var(--color-background-plain-text) 10%, color-mix(in srgb, var(--color-background-plain-text), 25% transparent) 90%) alpha; + --header-menu-icon-mask: linear-gradient(var(--color-background-plain-text) 25%, color-mix(in srgb, var(--color-background-plain-text), 55% transparent) 90%) alpha; --navigation-width: 300px; --sidebar-min-width: 300px; diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 7d06926c52f..bdd3048a498 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -196,9 +196,9 @@ class DefaultTheme implements ITheme { '--header-menu-item-height' => '44px', /* An alpha mask to be applied to all icons on the navigation bar (header menu). * Icons are have a size of 20px but usually we use MDI which have a content of 16px so 2px padding top bottom, - * for better gradient we set those 2px (10% of height) as start and stop positions, this is also somewhat size agnostic as we only depend on the percentage. + * for better gradient we must at first begin at those 2px (10% of height) as start and stop positions. */ - '--header-menu-icon-mask' => 'linear-gradient(var(--color-background-plain-text) 10%, color-mix(in srgb, var(--color-background-plain-text), 25% transparent) 90%) alpha', + '--header-menu-icon-mask' => 'linear-gradient(var(--color-background-plain-text) 25%, color-mix(in srgb, var(--color-background-plain-text), 55% transparent) 90%) alpha', // various structure data '--navigation-width' => '300px', |