From 872483f279732908d60d1a85abedcc8fb79a625a Mon Sep 17 00:00:00 2001 From: Simon L Date: Fri, 16 Jun 2023 14:03:23 +0200 Subject: [PATCH] only print deprecation logs if debug mode is enabled Signed-off-by: Simon L --- apps/files/js/filelist.js | 6 +++--- apps/files/js/files.js | 4 ++-- apps/files_sharing/src/services/ExternalLinkActions.js | 2 +- core/src/OC/capabilities.js | 2 +- core/src/OC/util.js | 4 ++-- core/src/OCA/search.js | 2 +- core/src/globals.js | 2 +- core/src/jquery/placeholder.js | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index c1b603da714..479956a4ddf 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -666,7 +666,7 @@ * @param {string} [tabId] optional tab id to select */ showDetailsView: function(fileName, tabId) { - console.debug('showDetailsView is deprecated! Use OCA.Files.Sidebar.activeTab. It will be removed in nextcloud 20.'); + OC.debug && console.debug('showDetailsView is deprecated! Use OCA.Files.Sidebar.activeTab. It will be removed in nextcloud 20.'); this._updateDetailsView(fileName); if (tabId) { OCA.Files.Sidebar.setActiveTab(tabId); @@ -3879,7 +3879,7 @@ * Register a tab view to be added to all views */ registerTabView: function(tabView) { - console.debug('registerTabView is deprecated! It will be removed in nextcloud 20.'); + OC.debug && console.debug('registerTabView is deprecated! It will be removed in nextcloud 20.'); const enabled = tabView.canDisplay || undefined if (tabView.id) { OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab({ @@ -3905,7 +3905,7 @@ * Register a detail view to be added to all views */ registerDetailView: function(detailView) { - console.debug('registerDetailView is deprecated! It will be removed in nextcloud 20.'); + OC.debug && console.debug('registerDetailView is deprecated! It will be removed in nextcloud 20.'); if (detailView.el) { OCA.Files.Sidebar.registerSecondaryView(detailView) } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index f37ad88c86a..7ce9079760f 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -281,7 +281,7 @@ * @deprecated used OCA.Files.FileList.generatePreviewUrl instead */ generatePreviewUrl: function(urlSpec) { - console.debug('DEPRECATED: please use generatePreviewUrl() from an OCA.Files.FileList instance'); + OC.debug && console.debug('DEPRECATED: please use generatePreviewUrl() from an OCA.Files.FileList instance'); return OCA.Files.App.fileList.generatePreviewUrl(urlSpec); }, @@ -290,7 +290,7 @@ * @deprecated used OCA.Files.FileList.lazyLoadPreview instead */ lazyLoadPreview : function(path, mime, ready, width, height, etag) { - console.debug('DEPRECATED: please use lazyLoadPreview() from an OCA.Files.FileList instance'); + OC.debug && console.debug('DEPRECATED: please use lazyLoadPreview() from an OCA.Files.FileList instance'); return FileList.lazyLoadPreview({ path: path, mime: mime, diff --git a/apps/files_sharing/src/services/ExternalLinkActions.js b/apps/files_sharing/src/services/ExternalLinkActions.js index bef668ae298..b8fe3b53994 100644 --- a/apps/files_sharing/src/services/ExternalLinkActions.js +++ b/apps/files_sharing/src/services/ExternalLinkActions.js @@ -52,7 +52,7 @@ export default class ExternalLinkActions { * @return {boolean} */ registerAction(action) { - console.debug('OCA.Sharing.ExternalLinkActions is deprecated, use OCA.Sharing.ExternalShareAction instead') + OC.debug && console.debug('OCA.Sharing.ExternalLinkActions is deprecated, use OCA.Sharing.ExternalShareAction instead') if (typeof action === 'object' && action.icon && action.name && action.url) { this._state.actions.push(action) diff --git a/core/src/OC/capabilities.js b/core/src/OC/capabilities.js index fffed92dede..8fc21abf369 100644 --- a/core/src/OC/capabilities.js +++ b/core/src/OC/capabilities.js @@ -32,6 +32,6 @@ import { getCapabilities as realGetCapabilities } from '@nextcloud/capabilities' * @since 14.0.0 */ export const getCapabilities = () => { - console.debug('OC.getCapabilities is deprecated and will be removed in Nextcloud 21. See @nextcloud/capabilities') + OC.debug && console.debug('OC.getCapabilities is deprecated and will be removed in Nextcloud 21. See @nextcloud/capabilities') return realGetCapabilities() } diff --git a/core/src/OC/util.js b/core/src/OC/util.js index db6b0eccae0..42ac73ef07d 100644 --- a/core/src/OC/util.js +++ b/core/src/OC/util.js @@ -124,7 +124,7 @@ export default { */ formatDate(timestamp, format) { if (window.TESTING === undefined) { - console.debug('OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') + OC.debug && console.debug('OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') } format = format || 'LLL' return moment(timestamp).format(format) @@ -136,7 +136,7 @@ export default { */ relativeModifiedDate(timestamp) { if (window.TESTING === undefined) { - console.debug('OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') + OC.debug && console.debug('OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') } const diff = moment().diff(moment(timestamp)) if (diff >= 0 && diff < 45000) { diff --git a/core/src/OCA/search.js b/core/src/OCA/search.js index e206e04f4b7..81a86a04247 100644 --- a/core/src/OCA/search.js +++ b/core/src/OCA/search.js @@ -26,7 +26,7 @@ export default class Search { * @deprecated 20.0.0, will be removed in Nextcloud 22 */ constructor() { - console.debug('OCA.Search is deprecated. Please use the unified search API instead') + OC.debug && console.debug('OCA.Search is deprecated. Please use the unified search API instead') } } diff --git a/core/src/globals.js b/core/src/globals.js index dcad2bcdbf6..61ad3921999 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -56,7 +56,7 @@ import { getToken as getRequestToken } from './OC/requesttoken.js' const warnIfNotTesting = function() { if (window.TESTING === undefined) { - console.debug.apply(console, arguments) + OC.debug && console.debug.apply(console, arguments) } } diff --git a/core/src/jquery/placeholder.js b/core/src/jquery/placeholder.js index d91c94c18ac..b77692fdf39 100644 --- a/core/src/jquery/placeholder.js +++ b/core/src/jquery/placeholder.js @@ -140,7 +140,7 @@ const toRgb = (s) => { } String.prototype.toRgb = function() { - console.debug('String.prototype.toRgb is deprecated! It will be removed in Nextcloud 22.') + OC.debug && console.debug('String.prototype.toRgb is deprecated! It will be removed in Nextcloud 22.') return toRgb(this) } -- 2.39.5