• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 27849033491

19 Jun 2026 09:22PM UTC coverage: 57.825%. First build
27849033491

Pull #7820

github

web-flow
Merge b9b27e047 into e7d9ccf99
Pull Request #7820: Improve notification preference reliability across environments

51 of 70 new or added lines in 5 files covered. (72.86%)

11136 of 19258 relevant lines covered (57.83%)

7.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

28.57
/lib/Service/ActivitySettingsStore.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Service;
10

11
class ActivitySettingsStore {
12
        private const USER_SETTINGS_CLASS = 'OCA\\Activity\\UserSettings';
13

14
        private bool $resolved = false;
15
        private ?object $activityUserSettings = null;
16

17
        public function isAvailable(): bool {
18
                return $this->getActivityUserSettings() !== null;
11✔
19
        }
20

21
        public function hasSetting(string $type): bool {
NEW
22
                if (!$this->isAvailable()) {
×
NEW
23
                        return false;
×
24
                }
25

26
                try {
NEW
27
                        $manager = \OCP\Server::get(\OCP\Activity\IManager::class);
×
NEW
28
                        $manager->getSettingById($type);
×
NEW
29
                        return true;
×
NEW
30
                } catch (\Throwable) {
×
NEW
31
                        return false;
×
32
                }
33
        }
34

35
        public function getAdminSetting(string $channel, string $type): mixed {
NEW
36
                return $this->getActivityUserSettings()?->getAdminSetting($channel, $type);
×
37
        }
38

39
        public function getUserSetting(string $userId, string $channel, string $type): mixed {
NEW
40
                return $this->getActivityUserSettings()?->getUserSetting($userId, $channel, $type);
×
41
        }
42

43
        private function getActivityUserSettings(): ?object {
44
                if ($this->resolved) {
11✔
45
                        return $this->activityUserSettings;
1✔
46
                }
47

48
                $this->resolved = true;
11✔
49
                if (!class_exists(self::USER_SETTINGS_CLASS)) {
11✔
50
                        return null;
11✔
51
                }
52

53
                try {
NEW
54
                        $activityUserSettings = \OCP\Server::get(self::USER_SETTINGS_CLASS);
×
NEW
55
                        if (is_object($activityUserSettings)) {
×
NEW
56
                                $this->activityUserSettings = $activityUserSettings;
×
57
                        }
NEW
58
                } catch (\Throwable) {
×
NEW
59
                        $this->activityUserSettings = null;
×
60
                }
61

NEW
62
                return $this->activityUserSettings;
×
63
        }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc