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

LibreSign / libresign / 20210417471

14 Dec 2025 03:51PM UTC coverage: 44.081%. First build
20210417471

Pull #6181

github

web-flow
Merge 21aee754a into 95a26cb92
Pull Request #6181: feat: cancel signature request notification

114 of 235 new or added lines in 9 files covered. (48.51%)

5932 of 13457 relevant lines covered (44.08%)

5.06 hits per line

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

0.0
/lib/Activity/Provider/SignRequestCanceled.php
1
<?php
2

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

9
namespace OCA\Libresign\Activity\Provider;
10

11
use OCA\Libresign\AppInfo\Application;
12
use OCP\Activity\Exceptions\UnknownActivityException;
13
use OCP\Activity\IEvent;
14
use OCP\Activity\IManager;
15
use OCP\Activity\IProvider;
16
use OCP\IURLGenerator;
17
use OCP\IUserManager;
18
use OCP\L10N\IFactory;
19
use OCP\RichObjectStrings\Definitions;
20

21
class SignRequestCanceled implements IProvider {
22
        public function __construct(
23
                protected IFactory $languageFactory,
24
                protected IURLGenerator $url,
25
                protected Definitions $definitions,
26
                protected IManager $activityManager,
27
                protected IUserManager $userManager,
28
        ) {
NEW
29
        }
×
30

31
        #[\Override]
32
        public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
NEW
33
                if ($event->getApp() !== Application::APP_ID) {
×
NEW
34
                        throw new UnknownActivityException('app');
×
35
                }
36

NEW
37
                if ($event->getSubject() !== 'sign_request_canceled') {
×
NEW
38
                        throw new UnknownActivityException('subject');
×
39
                }
40

NEW
41
                $this->definitions->definitions['sign-request'] = [
×
NEW
42
                        'author' => 'LibreSign',
×
NEW
43
                        'since' => '28.0.0',
×
NEW
44
                        'parameters' => [
×
NEW
45
                                'id' => [
×
NEW
46
                                        'since' => '28.0.0',
×
NEW
47
                                        'required' => true,
×
NEW
48
                                        'description' => 'The id of SignRequest object',
×
NEW
49
                                        'example' => '12345',
×
NEW
50
                                ],
×
NEW
51
                                'name' => [
×
NEW
52
                                        'since' => '28.0.0',
×
NEW
53
                                        'required' => true,
×
NEW
54
                                        'description' => 'The display name of signer',
×
NEW
55
                                        'example' => 'John Doe',
×
NEW
56
                                ],
×
NEW
57
                        ],
×
NEW
58
                ];
×
59

NEW
60
                if ($this->activityManager->getRequirePNG()) {
×
NEW
61
                        $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath(Application::APP_ID, 'app-dark.png')));
×
62
                } else {
NEW
63
                        $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath(Application::APP_ID, 'app-dark.svg')));
×
64
                }
65

NEW
66
                $l = $this->languageFactory->get(Application::APP_ID, $language);
×
NEW
67
                $parameters = $event->getSubjectParameters();
×
68

NEW
69
                $subject = $l->t('{from} canceled the signature request for {file}');
×
NEW
70
                $event->setParsedSubject(
×
NEW
71
                        str_replace(
×
NEW
72
                                ['{from}', '{file}'],
×
NEW
73
                                [
×
NEW
74
                                        $parameters['from']['name'],
×
NEW
75
                                        $parameters['file']['name'],
×
NEW
76
                                ],
×
NEW
77
                                $subject
×
NEW
78
                        ))
×
NEW
79
                        ->setRichSubject($subject, $parameters);
×
80

NEW
81
                return $event;
×
82
        }
83
}
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