Completed
Push — master ( 363a27...0ca584 )
by Maxence
06:28 queued 03:00
created

js/circles.app.results.links.js   A

Complexity

Total Complexity 5
Complexity/F 5

Size

Lines of Code 35
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
dl 0
loc 35
rs 10
cc 0
nc 1
mnd 2
bc 4
fnc 1
bpm 4
cpm 5
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B resultLinks.linkCircleResult 0 27 5
1
/*
2
 * Circles - Bring cloud-users closer together.
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2017
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
/** global: OC */
27
/** global: OCA */
28
/** global: Notyf */
29
30
/** global: actions */
31
/** global: nav */
32
/** global: elements */
33
/** global: curr */
34
/** global: api */
35
36
37
var resultLinks = {
38
39
40
	linkCircleResult: function (result) {
41
42
		//elements.linkCircle.val('');
43
		if (result.status !== 1) {
44
			OCA.notification.onFail(
45
				t('circles', "A link to <b>{remote}</b> could not be initiated", {
46
					remote: result.remote
47
				}) + ': ' +
48
				((result.error) ? result.error : t('circles', 'no error message')));
49
			return;
50
		}
51
52
		if (result.link.status === define.linkRequested) {
0 ignored issues
show
Bug introduced by
The variable define seems to be never declared. If this is a global, consider adding a /** global: define */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
53
			OCA.notification.onSuccess(
54
				t('circles', "A link to <b>{remote}</b> has been requested.", {
55
					remote: result.remote
56
				}));
57
		}
58
59
		if (result.link.status === define.linkUp) {
60
			OCA.notification.onSuccess(
61
				t('circles', "the link to <b>{remote}</b> is now up and running.", {
62
					remote: result.remote
63
				}));
64
		}
65
66
	},
67
68
69
70
71
};
72