summaryrefslogtreecommitdiffstats
path: root/core/js/public/whatsnew.js
blob: dc5862e85720ff0b61330379973df1a12f5368c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
 * @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
 *
 * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 */

(function(OCP) {
	"use strict";

	OCP.WhatsNew = {

		query: function(options) {
			options = options || {};
			$.ajax({
				type: 'GET',
				url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json',
				success: options.success || this._onQuerySuccess,
				error: options.error || this._onQueryError
			});
		},

		dismiss: function(version, options) {
			options = options || {};
			$.ajax({
				type: 'POST',
				url: options.url || OC.linkToOCS('core', 2) + 'whatsnew',
				data: {version: encodeURIComponent(version)},
				success: options.success || this._onDismissSuccess,
				error: options.error || this._onDismissError
			});
		},

		_onQuerySuccess: function(data, statusText) {
			console.debug('querying Whats New data was successful: ' + data || statusText);
			console.debug(data);
		},

		_onQueryError: function (o, t, e) {
			console.debug(o);
			console.debug('querying Whats New Data resulted in an error: ' + t +e);
		},

		_onDismissSuccess: function(data) {
			console.debug('dismissing Whats New data was successful: ' + data);
		},

		_onDismissError: function (data) {
			console.debug('dismissing Whats New data resulted in an error: ' + data);
		}
	};
})(OCP);