These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | /** |
||
2 | * @author Tahaa Karim <[email protected]> |
||
3 | * |
||
4 | * ownCloud - Mail |
||
5 | * |
||
6 | * This code is free software: you can redistribute it and/or modify |
||
7 | * it under the terms of the GNU Affero General Public License, version 3, |
||
8 | * as published by the Free Software Foundation. |
||
9 | * |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU Affero General Public License for more details. |
||
14 | * |
||
15 | * You should have received a copy of the GNU Affero General Public License, version 3, |
||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
||
17 | * |
||
18 | */ |
||
19 | |||
20 | define(function(require) { |
||
21 | 'use strict'; |
||
22 | |||
23 | var $ = require('jquery'); |
||
24 | var _ = require('underscore'); |
||
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
25 | var Radio = require('radio'); |
||
26 | |||
27 | Radio.aliases.reply('load:alias', loadAliases); |
||
28 | Radio.aliases.reply('save:alias', saveAlias); |
||
29 | Radio.aliases.reply('delete:alias', deleteAlias); |
||
30 | |||
31 | /** |
||
32 | * @param {Account} account |
||
33 | * @returns {undefined} |
||
34 | */ |
||
35 | function loadAliases(account) { |
||
0 ignored issues
–
show
|
|||
36 | var fetchingAliases = Radio.aliases.request('entities'); |
||
37 | |||
38 | $.when(fetchingAliases).fail(function() { |
||
39 | Radio.ui.trigger('error:show', t('mail', 'Fetching Aliases Failed.')); |
||
40 | }); |
||
41 | |||
42 | return fetchingAliases; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param {Account} account |
||
47 | * @param alias |
||
48 | * @returns {undefined} |
||
49 | */ |
||
50 | function saveAlias(account, alias) { |
||
51 | var savingAliases = Radio.aliases.request('save', account, alias); |
||
52 | |||
53 | $.when(savingAliases).fail(function() { |
||
54 | Radio.ui.trigger('error:show', t('mail', 'Saving Aliases Failed.')); |
||
55 | }); |
||
56 | |||
57 | return savingAliases; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param {Account} account |
||
62 | * @param aliasId |
||
63 | * @returns {undefined} |
||
64 | */ |
||
65 | function deleteAlias(account, aliasId) { |
||
66 | var deletingAliases = Radio.aliases.request('delete', account, aliasId); |
||
67 | |||
68 | $.when(deletingAliases).fail(function() { |
||
69 | Radio.ui.trigger('error:show', t('mail', 'Deleting Aliases Failed.')); |
||
70 | }); |
||
71 | |||
72 | return deletingAliases; |
||
73 | } |
||
74 | |||
75 | }); |
||
76 |