aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2023-11-15 18:26:27 +0100
committerGitHub <noreply@github.com>2023-11-15 18:26:27 +0100
commit33e07121d2cd0768209e5aad9d01a48ca7046aa8 (patch)
tree9ab7ef7adaef05eb5ee097322c6f92565106c136 /lib
parentd06ee45b80e8e0521cafb7692cc518af8354fda0 (diff)
parent45541eb685c4f3a5742508afcc02d07e46e64b5f (diff)
downloadnextcloud-server-33e07121d2cd0768209e5aad9d01a48ca7046aa8.tar.gz
nextcloud-server-33e07121d2cd0768209e5aad9d01a48ca7046aa8.zip
Merge pull request #41501 from nextcloud/feat/dav/show-ooo-ui-by-default
feat(dav): Enable OOO UI and expose enabled via OCP
Diffstat (limited to 'lib')
-rw-r--r--lib/private/User/AvailabilityCoordinator.php11
-rw-r--r--lib/public/User/IAvailabilityCoordinator.php9
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/private/User/AvailabilityCoordinator.php b/lib/private/User/AvailabilityCoordinator.php
index fe0db92fd0f..8e6b73bd56d 100644
--- a/lib/private/User/AvailabilityCoordinator.php
+++ b/lib/private/User/AvailabilityCoordinator.php
@@ -27,10 +27,12 @@ declare(strict_types=1);
namespace OC\User;
use JsonException;
+use OCA\DAV\AppInfo\Application;
use OCA\DAV\Db\AbsenceMapper;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\ICache;
use OCP\ICacheFactory;
+use OCP\IConfig;
use OCP\IUser;
use OCP\User\IAvailabilityCoordinator;
use OCP\User\IOutOfOfficeData;
@@ -42,11 +44,20 @@ class AvailabilityCoordinator implements IAvailabilityCoordinator {
public function __construct(
ICacheFactory $cacheFactory,
private AbsenceMapper $absenceMapper,
+ private IConfig $config,
private LoggerInterface $logger,
) {
$this->cache = $cacheFactory->createLocal('OutOfOfficeData');
}
+ public function isEnabled(): bool {
+ return $this->config->getAppValue(
+ Application::APP_ID,
+ 'hide_absence_settings',
+ 'no',
+ ) === 'no';
+ }
+
private function getCachedOutOfOfficeData(IUser $user): ?OutOfOfficeData {
$cachedString = $this->cache->get($user->getUID());
if ($cachedString === null) {
diff --git a/lib/public/User/IAvailabilityCoordinator.php b/lib/public/User/IAvailabilityCoordinator.php
index 113e3491714..749241f13bc 100644
--- a/lib/public/User/IAvailabilityCoordinator.php
+++ b/lib/public/User/IAvailabilityCoordinator.php
@@ -34,6 +34,15 @@ use OCP\IUser;
*/
interface IAvailabilityCoordinator {
/**
+ * Check if the feature is enabled on this instance
+ *
+ * @return bool
+ *
+ * @since 28.0.0
+ */
+ public function isEnabled(): bool;
+
+ /**
* Get the user's out-of-office message, if any
*
* @since 28.0.0