Skip to content

Commit

Permalink
fixup! feat: add availability action to the contacts menu
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Nov 27, 2024
1 parent d04e2be commit e2aea3c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
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 {
Expand Down Expand Up @@ -59,9 +61,19 @@ 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);

Check failure on line 71 in lib/AppInfo/Application.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

UndefinedDocblockClass

lib/AppInfo/Application.php:71:4: UndefinedDocblockClass: Docblock-defined class, interface or enum named OCP\ServerVersion does not exist (see https://psalm.dev/200)

Check failure on line 71 in lib/AppInfo/Application.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

UndefinedClass

lib/AppInfo/Application.php:71:37: UndefinedClass: Class, interface or enum named OCP\ServerVersion does not exist (see https://psalm.dev/019)
} catch (ContainerExceptionInterface $e) {
return;
}

// TODO: drop condition once we only support Nextcloud >= 31
/** @var ServerVersion $serverVersion */
$serverVersion = $context->getServerContainer()->get(ServerVersion::class);
if ($serverVersion->getMajorVersion() >= 31) {

Check failure on line 77 in lib/AppInfo/Application.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

UndefinedDocblockClass

lib/AppInfo/Application.php:77:7: UndefinedDocblockClass: Docblock-defined class, interface or enum named OCP\ServerVersion does not exist (see https://psalm.dev/200)
// The contacts menu/avatar is potentially shown everywhere so an event based loading
// mechanism doesn't make sense here
Expand Down

0 comments on commit e2aea3c

Please sign in to comment.