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

LibreSign / libresign / 21229403722

21 Jan 2026 11:23PM UTC coverage: 44.737%. First build
21229403722

Pull #6506

github

web-flow
Merge 4ac918368 into 35b6315b1
Pull Request #6506: feat: refactor identify account controller

117 of 163 new or added lines in 5 files covered. (71.78%)

7229 of 16159 relevant lines covered (44.74%)

4.91 hits per line

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

97.5
/lib/Service/Identify/ResultFormatter.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\Identify;
10

11
use OCA\Libresign\Collaboration\Collaborators\SignerPlugin;
12
use OCP\Share\IShare;
13

14
class ResultFormatter {
15
        public function formatForNcSelect(array $list): array {
16
                $formattedList = [];
6✔
17
                foreach ($list as $key => $item) {
6✔
18
                        $shareType = $item['value']['shareType'];
6✔
19
                        $method = $item['method'] ?? '';
6✔
20

21
                        // Determine if this is not a regular user account
22
                        $isNoUser = $shareType !== IShare::TYPE_USER;
6✔
23
                        if ($isNoUser && $method === 'account') {
6✔
24
                                $isNoUser = false;
1✔
25
                        }
26

27
                        $formattedList[$key] = [
6✔
28
                                'id' => $item['value']['shareWith'],
6✔
29
                                'isNoUser' => $isNoUser,
6✔
30
                                'displayName' => $item['label'],
6✔
31
                                'subname' => $item['shareWithDisplayNameUnique'] ?? '',
6✔
32
                        ];
6✔
33

34
                        if ($shareType === IShare::TYPE_EMAIL) {
6✔
35
                                $formattedList[$key]['method'] = 'email';
2✔
36
                                $formattedList[$key]['icon'] = 'icon-mail';
2✔
37
                        } elseif ($shareType === IShare::TYPE_USER) {
5✔
38
                                $formattedList[$key]['method'] = 'account';
2✔
39
                                $formattedList[$key]['icon'] = 'icon-user';
2✔
40
                        } elseif ($shareType === SignerPlugin::TYPE_SIGNER) {
4✔
41
                                $method = $item['method'] ?? '';
4✔
42
                                $formattedList[$key]['method'] = $method;
4✔
43

44
                                if ($method === 'email') {
4✔
45
                                        $formattedList[$key]['icon'] = 'icon-mail';
1✔
46
                                } elseif ($method === 'account') {
3✔
47
                                        $formattedList[$key]['icon'] = 'icon-user';
1✔
48
                                } else {
49
                                        $formattedList[$key]['iconSvg'] = 'svg' . ucfirst($method);
2✔
50
                                        $formattedList[$key]['iconName'] = $method;
2✔
51
                                }
52
                        }
53
                }
54
                return $formattedList;
6✔
55
        }
56

57
        public function replaceShareTypeWithMethod(array $list): array {
58
                foreach ($list as $key => $item) {
3✔
59
                        if (isset($item['method']) && !empty($item['method'])) {
3✔
60
                                unset($list[$key]['shareType']);
1✔
61
                                continue;
1✔
62
                        }
63
                        $list[$key]['method'] = match ($item['shareType']) {
2✔
64
                                IShare::TYPE_EMAIL => 'email',
2✔
65
                                IShare::TYPE_USER => 'account',
1✔
NEW
66
                                default => '',
×
67
                        };
2✔
68
                        unset($list[$key]['shareType']);
2✔
69
                }
70
                return $list;
3✔
71
        }
72
}
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