aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/OCP/whatsnew.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/OCP/whatsnew.js')
-rw-r--r--core/src/OCP/whatsnew.js39
1 files changed, 29 insertions, 10 deletions
diff --git a/core/src/OCP/whatsnew.js b/core/src/OCP/whatsnew.js
index 17c9eeabce2..acada6a8383 100644
--- a/core/src/OCP/whatsnew.js
+++ b/core/src/OCP/whatsnew.js
@@ -1,23 +1,21 @@
/**
- * @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.
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import _ from 'underscore'
import $ from 'jquery'
+import { generateOcsUrl } from '@nextcloud/router'
-import OC from '../OC/index'
-
+/**
+ * @param {any} options -
+ */
export function query(options) {
options = options || {}
const dismissOptions = options.dismiss || {}
$.ajax({
type: 'GET',
- url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json',
+ url: options.url || generateOcsUrl('core/whatsnew?format=json'),
success: options.success || function(data, statusText, xhr) {
onQuerySuccess(data, statusText, xhr, dismissOptions)
},
@@ -25,11 +23,15 @@ export function query(options) {
})
}
+/**
+ * @param {any} version -
+ * @param {any} options -
+ */
export function dismiss(version, options) {
options = options || {}
$.ajax({
type: 'POST',
- url: options.url || OC.linkToOCS('core', 2) + 'whatsnew',
+ url: options.url || generateOcsUrl('core/whatsnew'),
data: { version: encodeURIComponent(version) },
success: options.success || onDismissSuccess,
error: options.error || onDismissError,
@@ -38,6 +40,12 @@ export function dismiss(version, options) {
$('.whatsNewPopover').remove()
}
+/**
+ * @param {any} data -
+ * @param {any} statusText -
+ * @param {any} xhr -
+ * @param {any} dismissOptions -
+ */
function onQuerySuccess(data, statusText, xhr, dismissOptions) {
console.debug('querying Whats New data was successful: ' + statusText)
console.debug(data)
@@ -118,15 +126,26 @@ function onQuerySuccess(data, statusText, xhr, dismissOptions) {
document.body.appendChild(div)
}
+/**
+ * @param {any} x -
+ * @param {any} t -
+ * @param {any} e -
+ */
function onQueryError(x, t, e) {
console.debug('querying Whats New Data resulted in an error: ' + t + e)
console.debug(x)
}
+/**
+ * @param {any} data -
+ */
function onDismissSuccess(data) {
// noop
}
+/**
+ * @param {any} data -
+ */
function onDismissError(data) {
console.debug('dismissing Whats New data resulted in an error: ' + data)
}