diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 083efefad1..03c39d2596 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -20,7 +20,11 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\Collaboration\Reference\RenderReferenceEvent; +use OCP\ServerVersion; use OCP\User\Events\UserDeletedEvent; +use OCP\Util; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\ContainerInterface; use function method_exists; class Application extends App implements IBootstrap { @@ -57,5 +61,23 @@ public function register(IRegistrationContext $context): void { * @inheritDoc */ public function boot(IBootContext $context): void { + $this->addContactsMenuScript($context->getServerContainer()); + } + + private function addContactsMenuScript(ContainerInterface $container): void { + // ServerVersion was added in 31, but we don't care about older versions anyway + try { + /** @var ServerVersion $serverVersion */ + $serverVersion = $container->get(ServerVersion::class); + } catch (ContainerExceptionInterface $e) { + return; + } + + // TODO: drop condition once we only support Nextcloud >= 31 + if ($serverVersion->getMajorVersion() >= 31) { + // The contacts menu/avatar is potentially shown everywhere so an event based loading + // mechanism doesn't make sense here + Util::addScript(self::APP_ID, 'calendar-contacts-menu'); + } } } diff --git a/package-lock.json b/package-lock.json index fafceaf8c4..5361e8d978 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@fullcalendar/resource-timeline": "6.1.15", "@fullcalendar/timegrid": "6.1.15", "@fullcalendar/vue": "6.1.15", + "@mdi/svg": "^7.4.47", "@nextcloud/auth": "^2.4.0", "@nextcloud/axios": "^2.5.1", "@nextcloud/calendar-availability-vue": "^2.2.4", @@ -3227,6 +3228,12 @@ "resolved": "https://registry.npmjs.org/@mdi/js/-/js-7.4.47.tgz", "integrity": "sha512-KPnNOtm5i2pMabqZxpUz7iQf+mfrYZyKCZ8QNz85czgEt7cuHcGorWfdzUMWYA0SD+a6Hn4FmJ+YhzzzjkTZrQ==" }, + "node_modules/@mdi/svg": { + "version": "7.4.47", + "resolved": "https://registry.npmjs.org/@mdi/svg/-/svg-7.4.47.tgz", + "integrity": "sha512-WQ2gDll12T9WD34fdRFgQVgO8bag3gavrAgJ0frN4phlwdJARpE6gO1YvLEMJR0KKgoc+/Ea/A0Pp11I00xBvw==", + "license": "Apache-2.0" + }, "node_modules/@nextcloud/auth": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@nextcloud/auth/-/auth-2.4.0.tgz", diff --git a/package.json b/package.json index 4aa7ede210..26490489b4 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@fullcalendar/resource-timeline": "6.1.15", "@fullcalendar/timegrid": "6.1.15", "@fullcalendar/vue": "6.1.15", + "@mdi/svg": "^7.4.47", "@nextcloud/auth": "^2.4.0", "@nextcloud/axios": "^2.5.1", "@nextcloud/calendar-availability-vue": "^2.2.4", diff --git a/src/components/Editor/FreeBusy/FreeBusy.vue b/src/components/Editor/FreeBusy/FreeBusy.vue index af7ae4f008..030e4f8d14 100644 --- a/src/components/Editor/FreeBusy/FreeBusy.vue +++ b/src/components/Editor/FreeBusy/FreeBusy.vue @@ -5,7 +5,7 @@