aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/components/TemplatePreview.vue3
-rw-r--r--apps/files/src/files-app-settings.js5
-rw-r--r--apps/files/src/legacy/filelistSearch.js2
-rw-r--r--apps/files/src/logger.js2
-rw-r--r--apps/files/src/main-personal-settings.js34
-rw-r--r--apps/files/src/models/Setting.js3
-rw-r--r--apps/files/src/models/Tab.js4
-rw-r--r--apps/files/src/services/FileInfo.js5
-rw-r--r--apps/files/src/services/Settings.js7
-rw-r--r--apps/files/src/services/Sidebar.js10
-rw-r--r--apps/files/src/services/Templates.js2
-rw-r--r--apps/files/src/sidebar.js4
-rw-r--r--apps/files/src/templates.js2
-rw-r--r--apps/files/src/utils/davUtils.js5
-rw-r--r--apps/files/src/utils/fileUtils.js6
-rw-r--r--apps/files/src/views/Sidebar.vue49
-rw-r--r--apps/files/src/views/TemplatePicker.vue15
17 files changed, 82 insertions, 76 deletions
diff --git a/apps/files/src/components/TemplatePreview.vue b/apps/files/src/components/TemplatePreview.vue
index 89162ba4efd..ad152af9ea3 100644
--- a/apps/files/src/components/TemplatePreview.vue
+++ b/apps/files/src/components/TemplatePreview.vue
@@ -102,7 +102,8 @@ export default {
computed: {
/**
* Strip away extension from name
- * @returns {string}
+ *
+ * @return {string}
*/
nameWithoutExt() {
return this.basename.indexOf('.') > -1 ? this.basename.split('.').slice(0, -1).join('.') : this.basename
diff --git a/apps/files/src/files-app-settings.js b/apps/files/src/files-app-settings.js
index daaafbcd6c3..491ea127ccd 100644
--- a/apps/files/src/files-app-settings.js
+++ b/apps/files/src/files-app-settings.js
@@ -5,7 +5,7 @@
* @author Gary Kim <gary@garykim.dev>
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -37,6 +37,9 @@ Object.assign(window.OCA.Files, { Settings: new Settings() })
Object.assign(window.OCA.Files.Settings, { Setting })
window.addEventListener('DOMContentLoaded', function() {
+ if (window.TESTING) {
+ return
+ }
// Init Vue app
// eslint-disable-next-line
new Vue({
diff --git a/apps/files/src/legacy/filelistSearch.js b/apps/files/src/legacy/filelistSearch.js
index 712813e6050..9512f47eccc 100644
--- a/apps/files/src/legacy/filelistSearch.js
+++ b/apps/files/src/legacy/filelistSearch.js
@@ -3,7 +3,7 @@
*
* @author Julius Härtl <jus@bitgrid.net>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
diff --git a/apps/files/src/logger.js b/apps/files/src/logger.js
index b487e7caa9f..0005ee13cb4 100644
--- a/apps/files/src/logger.js
+++ b/apps/files/src/logger.js
@@ -4,7 +4,7 @@
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
diff --git a/apps/files/src/main-personal-settings.js b/apps/files/src/main-personal-settings.js
index 4a56e836ecd..1d1942e85bb 100644
--- a/apps/files/src/main-personal-settings.js
+++ b/apps/files/src/main-personal-settings.js
@@ -5,7 +5,7 @@
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -22,41 +22,17 @@
*
*/
-// global t
-
-/*
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
-import { generateFilePath } from '@nextcloud/router'
import PersonalSettings from './components/PersonalSettings'
// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
-// eslint-disable-next-line camelcase
-__webpack_public_path__ = generateFilePath('files', '', 'js/')
Vue.prototype.t = t
-const View = Vue.extend(PersonalSettings)
-new View().$mount('#files-personal-settings')
+if (!window.TESTING) {
+ const View = Vue.extend(PersonalSettings)
+ new View().$mount('#files-personal-settings')
+}
diff --git a/apps/files/src/models/Setting.js b/apps/files/src/models/Setting.js
index 128c28d8679..db276da85af 100644
--- a/apps/files/src/models/Setting.js
+++ b/apps/files/src/models/Setting.js
@@ -4,7 +4,7 @@
*
* @author Gary Kim <gary@garykim.dev>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -33,6 +33,7 @@ export default class Setting {
*
* @since 19.0.0
* @param {string} name the name of this setting
+ * @param {object} component the component
* @param {Function} component.el function that returns an unmounted dom element to be added
* @param {Function} [component.open] callback for when setting is added
* @param {Function} [component.close] callback for when setting is closed
diff --git a/apps/files/src/models/Tab.js b/apps/files/src/models/Tab.js
index b425fc16b2d..4c41ec5a3b1 100644
--- a/apps/files/src/models/Tab.js
+++ b/apps/files/src/models/Tab.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -34,7 +34,7 @@ export default class Tab {
/**
* Create a new tab instance
*
- * @param {Object} options destructuring object
+ * @param {object} options destructuring object
* @param {string} options.id the unique id of this tab
* @param {string} options.name the translated tab name
* @param {string} options.icon the vue component
diff --git a/apps/files/src/services/FileInfo.js b/apps/files/src/services/FileInfo.js
index 33284df5032..8b62063e134 100644
--- a/apps/files/src/services/FileInfo.js
+++ b/apps/files/src/services/FileInfo.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -22,6 +22,9 @@
import axios from '@nextcloud/axios'
+/**
+ * @param {any} url -
+ */
export default async function(url) {
const response = await axios({
method: 'PROPFIND',
diff --git a/apps/files/src/services/Settings.js b/apps/files/src/services/Settings.js
index d07033891a5..83c2c850580 100644
--- a/apps/files/src/services/Settings.js
+++ b/apps/files/src/services/Settings.js
@@ -3,7 +3,7 @@
*
* @author Gary Kim <gary@garykim.dev>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -34,7 +34,7 @@ export default class Settings {
*
* @since 19.0.0
* @param {OCA.Files.Settings.Setting} view element to add to settings
- * @returns {boolean} whether registering was successful
+ * @return {boolean} whether registering was successful
*/
register(view) {
if (this._settings.filter(e => e.name === view.name).length > 0) {
@@ -47,7 +47,8 @@ export default class Settings {
/**
* All settings elements
- * @returns {OCA.Files.Settings.Setting[]} All currently registered settings
+ *
+ * @return {OCA.Files.Settings.Setting[]} All currently registered settings
*/
get settings() {
return this._settings
diff --git a/apps/files/src/services/Sidebar.js b/apps/files/src/services/Sidebar.js
index c7b6ada2aea..e28dacb6b21 100644
--- a/apps/files/src/services/Sidebar.js
+++ b/apps/files/src/services/Sidebar.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -41,7 +41,7 @@ export default class Sidebar {
*
* @readonly
* @memberof Sidebar
- * @returns {Object} the data state
+ * @return {object} the data state
*/
get state() {
return this._state
@@ -51,8 +51,8 @@ export default class Sidebar {
* Register a new tab view
*
* @memberof Sidebar
- * @param {Object} tab a new unregistered tab
- * @returns {Boolean}
+ * @param {object} tab a new unregistered tab
+ * @return {boolean}
*/
registerTab(tab) {
const hasDuplicate = this._state.tabs.findIndex(check => check.id === tab.id) > -1
@@ -78,7 +78,7 @@ export default class Sidebar {
* Return current opened file
*
* @memberof Sidebar
- * @returns {String} the current opened file
+ * @return {string} the current opened file
*/
get file() {
return this._state.file
diff --git a/apps/files/src/services/Templates.js b/apps/files/src/services/Templates.js
index b466def408f..c242f9ae82d 100644
--- a/apps/files/src/services/Templates.js
+++ b/apps/files/src/services/Templates.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
diff --git a/apps/files/src/sidebar.js b/apps/files/src/sidebar.js
index bc483f833e8..58b798ed0e7 100644
--- a/apps/files/src/sidebar.js
+++ b/apps/files/src/sidebar.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -36,6 +36,8 @@ if (!window.OCA.Files) {
Object.assign(window.OCA.Files, { Sidebar: new Sidebar() })
Object.assign(window.OCA.Files.Sidebar, { Tab })
+console.debug('OCA.Files.Sidebar initialized')
+
window.addEventListener('DOMContentLoaded', function() {
const contentElement = document.querySelector('body > .content')
|| document.querySelector('body > #content')
diff --git a/apps/files/src/templates.js b/apps/files/src/templates.js
index a1a88f85106..7f7ebbf2dcc 100644
--- a/apps/files/src/templates.js
+++ b/apps/files/src/templates.js
@@ -4,7 +4,7 @@
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Julius Härtl <jus@bitgrid.net>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
diff --git a/apps/files/src/utils/davUtils.js b/apps/files/src/utils/davUtils.js
index b2a0bb2ebd8..1bd63347518 100644
--- a/apps/files/src/utils/davUtils.js
+++ b/apps/files/src/utils/davUtils.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -41,7 +41,8 @@ export const getToken = function() {
/**
* Return the current directory, fallback to root
- * @returns {string}
+ *
+ * @return {string}
*/
export const getCurrentDirectory = function() {
const currentDirInfo = OCA?.Files?.App?.currentFileList?.dirInfo
diff --git a/apps/files/src/utils/fileUtils.js b/apps/files/src/utils/fileUtils.js
index 7b78a85dc0e..5ab88c6eb63 100644
--- a/apps/files/src/utils/fileUtils.js
+++ b/apps/files/src/utils/fileUtils.js
@@ -3,7 +3,7 @@
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
- * @license GNU AGPL version 3 or any later version
+ * @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -34,8 +34,8 @@ const encodeFilePath = function(path) {
/**
* Extract dir and name from file path
*
- * @param {String} path the full path
- * @returns {String[]} [dirPath, fileName]
+ * @param {string} path the full path
+ * @return {string[]} [dirPath, fileName]
*/
const extractFilePaths = function(path) {
const pathSections = path.split('/')
diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue
index efbcdc35134..ec41240e3f2 100644
--- a/apps/files/src/views/Sidebar.vue
+++ b/apps/files/src/views/Sidebar.vue
@@ -121,7 +121,8 @@ export default {
* Current filename
* This is bound to the Sidebar service and
* is used to load a new file
- * @returns {string}
+ *
+ * @return {string}
*/
file() {
return this.Sidebar.file
@@ -129,7 +130,8 @@ export default {
/**
* List of all the registered tabs
- * @returns {Array}
+ *
+ * @return {Array}
*/
tabs() {
return this.Sidebar.tabs
@@ -137,7 +139,8 @@ export default {
/**
* List of all the registered views
- * @returns {Array}
+ *
+ * @return {Array}
*/
views() {
return this.Sidebar.views
@@ -145,7 +148,8 @@ export default {
/**
* Current user dav root path
- * @returns {string}
+ *
+ * @return {string}
*/
davPath() {
const user = OC.getCurrentUser().uid
@@ -154,8 +158,9 @@ export default {
/**
* Current active tab handler
+ *
* @param {string} id the tab id to set as active
- * @returns {string} the current active tab
+ * @return {string} the current active tab
*/
activeTab() {
return this.Sidebar.activeTab
@@ -163,7 +168,8 @@ export default {
/**
* Sidebar subtitle
- * @returns {string}
+ *
+ * @return {string}
*/
subtitle() {
return `${this.size}, ${this.time}`
@@ -171,7 +177,8 @@ export default {
/**
* File last modified formatted string
- * @returns {string}
+ *
+ * @return {string}
*/
time() {
return OC.Util.relativeModifiedDate(this.fileInfo.mtime)
@@ -179,7 +186,8 @@ export default {
/**
* File last modified full string
- * @returns {string}
+ *
+ * @return {string}
*/
fullTime() {
return moment(this.fileInfo.mtime).format('LLL')
@@ -187,7 +195,8 @@ export default {
/**
* File size formatted string
- * @returns {string}
+ *
+ * @return {string}
*/
size() {
return OC.Util.humanFileSize(this.fileInfo.size)
@@ -195,7 +204,8 @@ export default {
/**
* File background/figure to illustrate the sidebar header
- * @returns {string}
+ *
+ * @return {string}
*/
background() {
return this.getPreviewIfAny(this.fileInfo)
@@ -204,7 +214,7 @@ export default {
/**
* App sidebar v-binding object
*
- * @returns {Object}
+ * @return {object}
*/
appSidebar() {
if (this.fileInfo) {
@@ -243,7 +253,7 @@ export default {
/**
* Default action object for the current file
*
- * @returns {Object}
+ * @return {object}
*/
defaultAction() {
return this.fileInfo
@@ -260,7 +270,7 @@ export default {
* nothing is listening for a click if there
* is no default action
*
- * @returns {string|null}
+ * @return {string|null}
*/
defaultActionListener() {
return this.defaultAction ? 'figure-click' : null
@@ -275,8 +285,8 @@ export default {
/**
* Can this tab be displayed ?
*
- * @param {Object} tab a registered tab
- * @returns {boolean}
+ * @param {object} tab a registered tab
+ * @return {boolean}
*/
canDisplay(tab) {
return tab.enabled(this.fileInfo)
@@ -302,8 +312,8 @@ export default {
* Copied from https://github.com/nextcloud/server/blob/16e0887ec63591113ee3f476e0c5129e20180cde/apps/files/js/filelist.js#L1377
* TODO: We also need this as a standalone library
*
- * @param {Object} fileInfo the fileinfo
- * @returns {string} Url to the icon for mimeType
+ * @param {object} fileInfo the fileinfo
+ * @return {string} Url to the icon for mimeType
*/
getIconUrl(fileInfo) {
const mimeType = fileInfo.mimetype || 'application/octet-stream'
@@ -341,7 +351,7 @@ export default {
* Toggle favourite state
* TODO: better implementation
*
- * @param {Boolean} state favourited or not
+ * @param {boolean} state favourited or not
*/
async toggleStarred(state) {
try {
@@ -397,7 +407,7 @@ export default {
* Open the sidebar for the given file
*
* @param {string} path the file path to load
- * @returns {Promise}
+ * @return {Promise}
* @throws {Error} loading failure
*/
async open(path) {
@@ -446,6 +456,7 @@ export default {
/**
* Allow to set the Sidebar as fullscreen from OCA.Files.Sidebar
+ *
* @param {boolean} isFullScreen - Wether or not to render the Sidebar in fullscreen.
*/
setFullScreenMode(isFullScreen) {
diff --git a/apps/files/src/views/TemplatePicker.vue b/apps/files/src/views/TemplatePicker.vue
index 7c866db8a58..4e0fc8c7a54 100644
--- a/apps/files/src/views/TemplatePicker.vue
+++ b/apps/files/src/views/TemplatePicker.vue
@@ -109,7 +109,8 @@ export default {
computed: {
/**
* Strip away extension from name
- * @returns {string}
+ *
+ * @return {string}
*/
nameWithoutExt() {
return this.name.indexOf('.') > -1
@@ -133,7 +134,8 @@ export default {
/**
* Style css vars bin,d
- * @returns {Object}
+ *
+ * @return {object}
*/
style() {
return {
@@ -149,6 +151,7 @@ export default {
methods: {
/**
* Open the picker
+ *
* @param {string} name the file name to create
* @param {object} provider the template provider picked
*/
@@ -188,6 +191,7 @@ export default {
/**
* Manages the radio template picker change
+ *
* @param {number} fileid the selected template file id
*/
onCheck(fileid) {
@@ -213,8 +217,11 @@ export default {
)
this.logger.debug('Created new file', fileInfo)
- await fileList?.addAndFetchFileInfo(this.name)
+ const data = await fileList?.addAndFetchFileInfo(this.name).then((status, data) => data)
+ const model = new OCA.Files.FileInfoModel(data, {
+ filesClient: fileList?.filesClient,
+ })
// Run default action
const fileAction = OCA.Files.fileActions.getDefaultFileAction(fileInfo.mime, 'file', OC.PERMISSION_ALL)
fileAction.action(fileInfo.basename, {
@@ -222,7 +229,7 @@ export default {
dir: currentDirectory,
fileList,
fileActions: fileList?.fileActions,
- fileInfoModel: fileList?.getModelForFile(this.name),
+ fileInfoModel: model,
})
this.close()