Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>tags/v24.0.0beta1
@@ -16,5 +16,9 @@ module.exports = { | |||
// TODO: make sure we fix this as this is bad vue coding style. | |||
// Use proper sync modifier | |||
'vue/no-mutating-props': 'warn', | |||
'vue/custom-event-name-casing': ['error', 'kebab-case', { | |||
// allows custom xxxx:xxx events formats | |||
ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'], | |||
}], | |||
}, | |||
} |
@@ -166,7 +166,8 @@ export default { | |||
/** | |||
* Is the current user the author of this comment | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isOwnComment() { | |||
return getCurrentUser().uid === this.actorId | |||
@@ -174,7 +175,8 @@ export default { | |||
/** | |||
* Rendered content as html string | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
renderedContent() { | |||
if (this.isEmptyMessage) { | |||
@@ -208,6 +210,7 @@ export default { | |||
methods: { | |||
/** | |||
* Update local Message on outer change | |||
* | |||
* @param {string} message the message to set | |||
*/ | |||
updateLocalMessage(message) { |
@@ -49,7 +49,7 @@ export default class CommentInstance { | |||
* Initialize a new Comments instance for the desired type | |||
* | |||
* @param {string} commentsType the comments endpoint type | |||
* @param {Object} options the vue options (propsData, parent, el...) | |||
* @param {object} options the vue options (propsData, parent, el...) | |||
*/ | |||
constructor(commentsType = 'files', options) { | |||
// Add comments type as a global mixin |
@@ -28,11 +28,11 @@ export const DEFAULT_LIMIT = 20 | |||
/** | |||
* Retrieve the comments list | |||
* | |||
* @param {Object} data destructuring object | |||
* @param {object} data destructuring object | |||
* @param {string} data.commentsType the ressource type | |||
* @param {number} data.ressourceId the ressource ID | |||
* @param {Object} [options] optional options for axios | |||
* @returns {Object[]} the comments list | |||
* @param {object} [options] optional options for axios | |||
* @return {object[]} the comments list | |||
*/ | |||
export default async function({ commentsType, ressourceId }, options = {}) { | |||
let response = null | |||
@@ -64,6 +64,10 @@ export default async function({ commentsType, ressourceId }, options = {}) { | |||
} | |||
// https://github.com/perry-mitchell/webdav-client/blob/9de2da4a2599e06bd86c2778145b7ade39fe0b3c/source/interface/directoryContents.js#L32 | |||
/** | |||
* @param result | |||
* @param isDetailed | |||
*/ | |||
function processMultistatus(result, isDetailed = false) { | |||
// Extract the response items (directory contents) | |||
const { | |||
@@ -86,6 +90,10 @@ function processMultistatus(result, isDetailed = false) { | |||
}) | |||
} | |||
/** | |||
* @param value | |||
* @param passes | |||
*/ | |||
function decodeHtmlEntities(value, passes = 1) { | |||
const parser = new DOMParser() | |||
let decoded = value |
@@ -31,7 +31,7 @@ import client from './DavClient' | |||
* @param {string} commentsType the ressource type | |||
* @param {number} ressourceId the ressource ID | |||
* @param {string} message the message | |||
* @returns {Object} the new comment | |||
* @return {object} the new comment | |||
*/ | |||
export default async function(commentsType, ressourceId, message) { | |||
const ressourcePath = ['', commentsType, ressourceId].join('/') |
@@ -24,15 +24,16 @@ import axios from '@nextcloud/axios' | |||
/** | |||
* Create a cancel token | |||
* @returns {CancelTokenSource} | |||
* | |||
* @return {CancelTokenSource} | |||
*/ | |||
const createCancelToken = () => axios.CancelToken.source() | |||
/** | |||
* Creates a cancelable axios 'request object'. | |||
* | |||
* @param {function} request the axios promise request | |||
* @returns {Object} | |||
* @param {Function} request the axios promise request | |||
* @return {object} | |||
*/ | |||
const cancelableRequest = function(request) { | |||
/** | |||
@@ -44,7 +45,7 @@ const cancelableRequest = function(request) { | |||
* Execute the request | |||
* | |||
* @param {string} url the url to send the request to | |||
* @param {Object} [options] optional config for the request | |||
* @param {object} [options] optional config for the request | |||
*/ | |||
const fetch = async function(url, options) { | |||
return request( |
@@ -126,7 +126,8 @@ export default { | |||
methods: { | |||
/** | |||
* Update current ressourceId and fetch new data | |||
* @param {Number} ressourceId the current ressourceId (fileId...) | |||
* | |||
* @param {number} ressourceId the current ressourceId (fileId...) | |||
*/ | |||
async update(ressourceId) { | |||
this.ressourceId = ressourceId | |||
@@ -152,8 +153,9 @@ export default { | |||
/** | |||
* Make sure we have all mentions as Array of objects | |||
* | |||
* @param {Array} mentions the mentions list | |||
* @returns {Object[]} | |||
* @return {object[]} | |||
*/ | |||
genMentionsData(mentions) { | |||
const list = Object.values(mentions).flat() | |||
@@ -217,6 +219,7 @@ export default { | |||
/** | |||
* Autocomplete @mentions | |||
* | |||
* @param {string} search the query | |||
* @param {Function} callback the callback to process the results with | |||
*/ | |||
@@ -235,7 +238,8 @@ export default { | |||
/** | |||
* Add newly created comment to the list | |||
* @param {Object} comment the new comment | |||
* | |||
* @param {object} comment the new comment | |||
*/ | |||
onNewComment(comment) { | |||
this.comments.unshift(comment) | |||
@@ -243,6 +247,7 @@ export default { | |||
/** | |||
* Remove deleted comment from the list | |||
* | |||
* @param {number} id the deleted comment | |||
*/ | |||
onDelete(id) { |
@@ -266,7 +266,7 @@ export default { | |||
* Method to register panels that will be called by the integrating apps | |||
* | |||
* @param {string} app The unique app id for the widget | |||
* @param {function} callback The callback function to register a panel which gets the DOM element passed as parameter | |||
* @param {Function} callback The callback function to register a panel which gets the DOM element passed as parameter | |||
*/ | |||
register(app, callback) { | |||
Vue.set(this.callbacks, app, callback) |
@@ -25,6 +25,9 @@ import { parseXML } from 'webdav/dist/node/tools/dav' | |||
import { getZoneString } from 'icalzone' | |||
import { v4 as uuidv4 } from 'uuid' | |||
/** | |||
* | |||
*/ | |||
export function getEmptySlots() { | |||
return { | |||
MO: [], | |||
@@ -37,6 +40,9 @@ export function getEmptySlots() { | |||
} | |||
} | |||
/** | |||
* | |||
*/ | |||
export async function findScheduleInboxAvailability() { | |||
const client = getClient('calendars') | |||
@@ -101,6 +107,10 @@ export async function findScheduleInboxAvailability() { | |||
} | |||
} | |||
/** | |||
* @param slots | |||
* @param timezoneId | |||
*/ | |||
export async function saveScheduleInboxAvailability(slots, timezoneId) { | |||
const all = [...Object.keys(slots).flatMap(dayId => slots[dayId].map(slot => ({ | |||
...slot, |
@@ -31,7 +31,7 @@ describe('CalDavSettings', () => { | |||
global.OCP = originalOCP | |||
}) | |||
test('interactions', async() => { | |||
test('interactions', async () => { | |||
const TLUtils = render( | |||
CalDavSettings, | |||
{ |
@@ -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 |
@@ -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 |
@@ -22,6 +22,9 @@ | |||
import axios from '@nextcloud/axios' | |||
/** | |||
* @param url | |||
*/ | |||
export default async function(url) { | |||
const response = await axios({ | |||
method: 'PROPFIND', |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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('/') |
@@ -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) { |
@@ -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) { |
@@ -232,7 +232,7 @@ export default { | |||
/** | |||
* Can the sharer set whether the sharee can edit the file ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
canSetEdit() { | |||
// If the owner revoked the permission after the resharer granted it | |||
@@ -244,7 +244,7 @@ export default { | |||
/** | |||
* Can the sharer set whether the sharee can create the file ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
canSetCreate() { | |||
// If the owner revoked the permission after the resharer granted it | |||
@@ -256,7 +256,7 @@ export default { | |||
/** | |||
* Can the sharer set whether the sharee can delete the file ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
canSetDelete() { | |||
// If the owner revoked the permission after the resharer granted it | |||
@@ -268,7 +268,7 @@ export default { | |||
/** | |||
* Can the sharer set whether the sharee can reshare the file ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
canSetReshare() { | |||
// If the owner revoked the permission after the resharer granted it | |||
@@ -337,7 +337,8 @@ export default { | |||
/** | |||
* Is the current share a folder ? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isFolder() { | |||
return this.fileInfo.type === 'dir' | |||
@@ -345,7 +346,8 @@ export default { | |||
/** | |||
* Does the current share have an expiration date | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
hasExpirationDate: { | |||
get() { | |||
@@ -371,7 +373,7 @@ export default { | |||
}, | |||
/** | |||
* @returns {bool} | |||
* @return {bool} | |||
*/ | |||
hasStatus() { | |||
if (this.share.type !== this.SHARE_TYPES.SHARE_TYPE_USER) { |
@@ -49,7 +49,8 @@ export default { | |||
computed: { | |||
/** | |||
* Get the internal link to this file id | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
internalLink() { | |||
return window.location.protocol + '//' + window.location.host + generateUrl('/f/') + this.fileInfo.id | |||
@@ -57,7 +58,8 @@ export default { | |||
/** | |||
* Clipboard v-tooltip message | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
clipboardTooltip() { | |||
if (this.copied) { |
@@ -400,7 +400,8 @@ export default { | |||
* Return the current share permissions | |||
* We always ignore the SHARE permission as this is used for the | |||
* federated sharing. | |||
* @returns {number} | |||
* | |||
* @return {number} | |||
*/ | |||
sharePermissions() { | |||
return this.share.permissions & ~OC.PERMISSION_SHARE | |||
@@ -409,7 +410,8 @@ export default { | |||
* Generate a unique random id for this SharingEntryLink only | |||
* This allows ActionRadios to have the same name prop | |||
* but not to impact others SharingEntryLink | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
randomId() { | |||
return Math.random().toString(27).substr(2) | |||
@@ -417,7 +419,8 @@ export default { | |||
/** | |||
* Link share label | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
title() { | |||
// if we have a valid existing share (not pending) | |||
@@ -452,7 +455,8 @@ export default { | |||
/** | |||
* Show the email on a second line if a label is set for mail shares | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
subtitle() { | |||
if (this.isEmailShareType | |||
@@ -464,7 +468,8 @@ export default { | |||
/** | |||
* Does the current share have an expiration date | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
hasExpirationDate: { | |||
get() { | |||
@@ -490,7 +495,8 @@ export default { | |||
/** | |||
* Is the current share password protected ? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isPasswordProtected: { | |||
get() { | |||
@@ -506,7 +512,8 @@ export default { | |||
/** | |||
* Is Talk enabled? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isTalkEnabled() { | |||
return OC.appswebroots.spreed !== undefined | |||
@@ -514,7 +521,8 @@ export default { | |||
/** | |||
* Is it possible to protect the password by Talk? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isPasswordProtectedByTalkAvailable() { | |||
return this.isPasswordProtected && this.isTalkEnabled | |||
@@ -522,7 +530,8 @@ export default { | |||
/** | |||
* Is the current share password protected by Talk? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isPasswordProtectedByTalk: { | |||
get() { | |||
@@ -535,7 +544,8 @@ export default { | |||
/** | |||
* Is the current share an email share ? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isEmailShareType() { | |||
return this.share | |||
@@ -561,7 +571,8 @@ export default { | |||
* Pending data. | |||
* If the share still doesn't have an id, it is not synced | |||
* Therefore this is still not valid and requires user input | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
pendingPassword() { | |||
return this.config.enforcePasswordForPublicLink && this.share && !this.share.id | |||
@@ -572,7 +583,8 @@ export default { | |||
/** | |||
* Can the recipient edit the file ? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
canUpdate: { | |||
get() { | |||
@@ -594,7 +606,8 @@ export default { | |||
/** | |||
* Is the current share a folder ? | |||
* TODO: move to a proper FileInfo model? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
isFolder() { | |||
return this.fileInfo.type === 'dir' | |||
@@ -603,7 +616,8 @@ export default { | |||
/** | |||
* Does the current file/folder have create permissions | |||
* TODO: move to a proper FileInfo model? | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
*/ | |||
fileHasCreatePermission() { | |||
return !!(this.fileInfo.permissions & OC.PERMISSION_CREATE) | |||
@@ -611,7 +625,8 @@ export default { | |||
/** | |||
* Return the public share link | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
shareLink() { | |||
return window.location.protocol + '//' + window.location.host + generateUrl('/s/') + this.share.token | |||
@@ -619,7 +634,8 @@ export default { | |||
/** | |||
* Clipboard v-tooltip message | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
clipboardTooltip() { | |||
if (this.copied) { | |||
@@ -632,8 +648,9 @@ export default { | |||
/** | |||
* External additionnai actions for the menu | |||
* | |||
* @deprecated use OCA.Sharing.ExternalShareActions | |||
* @returns {Array} | |||
* @return {Array} | |||
*/ | |||
externalLegacyLinkActions() { | |||
return this.ExternalLegacyLinkActions.actions | |||
@@ -641,7 +658,8 @@ export default { | |||
/** | |||
* Additional actions for the menu | |||
* @returns {Array} | |||
* | |||
* @return {Array} | |||
*/ | |||
externalLinkActions() { | |||
// filter only the registered actions for said link | |||
@@ -794,6 +812,7 @@ export default { | |||
/** | |||
* On permissions change | |||
* | |||
* @param {Event} event js event | |||
*/ | |||
togglePermissions(event) { | |||
@@ -804,7 +823,8 @@ export default { | |||
/** | |||
* Label changed, let's save it to a different key | |||
* @param {String} label the share label | |||
* | |||
* @param {string} label the share label | |||
*/ | |||
onLabelChange(label) { | |||
this.$set(this.share, 'newLabel', label.trim()) | |||
@@ -846,6 +866,7 @@ export default { | |||
* If both co-exists, the password have changed and | |||
* we show it in plain text. | |||
* Then on submit (or menu close), we sync it. | |||
* | |||
* @param {string} password the changed password | |||
*/ | |||
onPasswordChange(password) { |
@@ -114,7 +114,7 @@ export default { | |||
* results into the autocomplete dropdown | |||
* Used for the guests app | |||
* | |||
* @returns {Array} | |||
* @return {Array} | |||
*/ | |||
externalResults() { | |||
return this.ShareSearch.results | |||
@@ -321,8 +321,8 @@ export default { | |||
* Filter out existing shares from | |||
* the provided shares search results | |||
* | |||
* @param {Object[]} shares the array of shares object | |||
* @returns {Object[]} | |||
* @param {object[]} shares the array of shares object | |||
* @return {object[]} | |||
*/ | |||
filterOutExistingShares(shares) { | |||
return shares.reduce((arr, share) => { | |||
@@ -376,8 +376,9 @@ export default { | |||
/** | |||
* Get the icon based on the share type | |||
* | |||
* @param {number} type the share type | |||
* @returns {string} the icon class | |||
* @return {string} the icon class | |||
*/ | |||
shareTypeToIcon(type) { | |||
switch (type) { | |||
@@ -406,8 +407,9 @@ export default { | |||
/** | |||
* Format shares for the multiselect options | |||
* @param {Object} result select entry item | |||
* @returns {Object} | |||
* | |||
* @param {object} result select entry item | |||
* @return {object} | |||
*/ | |||
formatForMultiselect(result) { | |||
let subtitle | |||
@@ -438,7 +440,8 @@ export default { | |||
/** | |||
* Process the new share request | |||
* @param {Object} value the multiselect option | |||
* | |||
* @param {object} value the multiselect option | |||
*/ | |||
async addShare(value) { | |||
if (value.lookup) { |
@@ -40,7 +40,7 @@ export default { | |||
/** | |||
* Create a new share | |||
* | |||
* @param {Object} data destructuring object | |||
* @param {object} data destructuring object | |||
* @param {string} data.path path to the file/folder which should be shared | |||
* @param {number} data.shareType 0 = user; 1 = group; 3 = public link; 6 = federated cloud share | |||
* @param {string} data.shareWith user/group id with which the file should be shared (optional for shareType > 1) | |||
@@ -50,7 +50,7 @@ export default { | |||
* @param {boolean} [data.sendPasswordByTalk=false] send the password via a talk conversation | |||
* @param {string} [data.expireDate=''] expire the shareautomatically after | |||
* @param {string} [data.label=''] custom label | |||
* @returns {Share} the new share | |||
* @return {Share} the new share | |||
* @throws {Error} | |||
*/ | |||
async createShare({ path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label }) { | |||
@@ -99,7 +99,7 @@ export default { | |||
* Update a share | |||
* | |||
* @param {number} id share id | |||
* @param {Object} properties key-value object of the properties to update | |||
* @param {object} properties key-value object of the properties to update | |||
*/ | |||
async updateShare(id, properties) { | |||
try { |
@@ -32,7 +32,7 @@ export default class Share { | |||
/** | |||
* Create the share object | |||
* | |||
* @param {Object} ocsData ocs request response | |||
* @param {object} ocsData ocs request response | |||
*/ | |||
constructor(ocsData) { | |||
if (ocsData.ocs && ocsData.ocs.data && ocsData.ocs.data[0]) { | |||
@@ -54,7 +54,7 @@ export default class Share { | |||
* inject its watchers into the #share | |||
* state and make the whole class reactive | |||
* | |||
* @returns {Object} the share raw state | |||
* @return {object} the share raw state | |||
* @readonly | |||
* @memberof Sidebar | |||
*/ | |||
@@ -65,7 +65,7 @@ export default class Share { | |||
/** | |||
* get the share id | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -76,7 +76,7 @@ export default class Share { | |||
/** | |||
* Get the share type | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -88,7 +88,7 @@ export default class Share { | |||
* Get the share permissions | |||
* See OC.PERMISSION_* variables | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -111,7 +111,7 @@ export default class Share { | |||
/** | |||
* Get the share owner uid | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -122,7 +122,7 @@ export default class Share { | |||
/** | |||
* Get the share owner's display name | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -134,7 +134,7 @@ export default class Share { | |||
/** | |||
* Get the share with entity uid | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -146,7 +146,7 @@ export default class Share { | |||
* Get the share with entity display name | |||
* fallback to its uid if none | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -159,7 +159,7 @@ export default class Share { | |||
* Unique display name in case of multiple | |||
* duplicates results with the same name. | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -171,7 +171,7 @@ export default class Share { | |||
/** | |||
* Get the share with entity link | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -182,7 +182,7 @@ export default class Share { | |||
/** | |||
* Get the share with avatar if any | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -194,7 +194,7 @@ export default class Share { | |||
/** | |||
* Get the shared item owner uid | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -206,7 +206,7 @@ export default class Share { | |||
* Get the shared item display name | |||
* fallback to its uid if none | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -219,7 +219,7 @@ export default class Share { | |||
/** | |||
* Get the share creation timestamp | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -230,7 +230,7 @@ export default class Share { | |||
/** | |||
* Get the expiration date as a string format | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -253,7 +253,7 @@ export default class Share { | |||
/** | |||
* Get the public share token | |||
* | |||
* @returns {string} the token | |||
* @return {string} the token | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -264,7 +264,7 @@ export default class Share { | |||
/** | |||
* Get the share note if any | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -286,7 +286,7 @@ export default class Share { | |||
* Get the share label if any | |||
* Should only exist on link shares | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -308,7 +308,7 @@ export default class Share { | |||
/** | |||
* Have a mail been sent | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -319,7 +319,7 @@ export default class Share { | |||
/** | |||
* Hide the download button on public page | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -340,7 +340,7 @@ export default class Share { | |||
/** | |||
* Password protection of the share | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -361,7 +361,7 @@ export default class Share { | |||
/** | |||
* Password protection by Talk of the share | |||
* | |||
* @returns {Boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -372,7 +372,7 @@ export default class Share { | |||
/** | |||
* Password protection by Talk of the share | |||
* | |||
* @param {Boolean} sendPasswordByTalk whether to send the password by Talk | |||
* @param {boolean} sendPasswordByTalk whether to send the password by Talk | |||
* or not | |||
* @memberof Share | |||
*/ | |||
@@ -384,7 +384,7 @@ export default class Share { | |||
/** | |||
* Get the shared item absolute full path | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -395,7 +395,7 @@ export default class Share { | |||
/** | |||
* Return the item type: file or folder | |||
* | |||
* @returns {string} 'folder' or 'file' | |||
* @return {string} 'folder' or 'file' | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -406,7 +406,7 @@ export default class Share { | |||
/** | |||
* Get the shared item mimetype | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -417,7 +417,7 @@ export default class Share { | |||
/** | |||
* Get the shared item id | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -430,7 +430,7 @@ export default class Share { | |||
* e.g the file /xxx/aaa will be shared in | |||
* the receiving root as /aaa, the fileTarget is /aaa | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -441,7 +441,7 @@ export default class Share { | |||
/** | |||
* Get the parent folder id if any | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -454,7 +454,7 @@ export default class Share { | |||
/** | |||
* Does this share have READ permissions | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -465,7 +465,7 @@ export default class Share { | |||
/** | |||
* Does this share have CREATE permissions | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -476,7 +476,7 @@ export default class Share { | |||
/** | |||
* Does this share have DELETE permissions | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -487,7 +487,7 @@ export default class Share { | |||
/** | |||
* Does this share have UPDATE permissions | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -498,7 +498,7 @@ export default class Share { | |||
/** | |||
* Does this share have SHARE permissions | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -512,7 +512,7 @@ export default class Share { | |||
/** | |||
* Can the current user EDIT this share ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -523,7 +523,7 @@ export default class Share { | |||
/** | |||
* Can the current user DELETE this share ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -533,7 +533,8 @@ export default class Share { | |||
/** | |||
* Top level accessible shared folder fileid for the current user | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ | |||
@@ -543,7 +544,8 @@ export default class Share { | |||
/** | |||
* Top level accessible shared folder path for the current user | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
* @readonly | |||
* @memberof Share | |||
*/ |
@@ -27,7 +27,7 @@ export default class Config { | |||
/** | |||
* Is public upload allowed on link shares ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -39,7 +39,7 @@ export default class Config { | |||
/** | |||
* Are link share allowed ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -51,7 +51,7 @@ export default class Config { | |||
/** | |||
* Get the federated sharing documentation link | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -62,7 +62,7 @@ export default class Config { | |||
/** | |||
* Get the default link share expiration date as string | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -80,7 +80,7 @@ export default class Config { | |||
/** | |||
* Get the default internal expiration date as string | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -98,7 +98,7 @@ export default class Config { | |||
/** | |||
* Get the default remote expiration date as string | |||
* | |||
* @returns {string} | |||
* @return {string} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -116,7 +116,7 @@ export default class Config { | |||
/** | |||
* Are link shares password-enforced ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -127,7 +127,7 @@ export default class Config { | |||
/** | |||
* Is password asked by default on link shares ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -138,7 +138,7 @@ export default class Config { | |||
/** | |||
* Is link shares expiration enforced ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -149,7 +149,7 @@ export default class Config { | |||
/** | |||
* Is there a default expiration date for new link shares ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -160,7 +160,7 @@ export default class Config { | |||
/** | |||
* Is internal shares expiration enforced ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -171,7 +171,7 @@ export default class Config { | |||
/** | |||
* Is remote shares expiration enforced ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -182,7 +182,7 @@ export default class Config { | |||
/** | |||
* Is there a default expiration date for new internal shares ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -193,7 +193,7 @@ export default class Config { | |||
/** | |||
* Are users on this server allowed to send shares to other servers ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -204,7 +204,7 @@ export default class Config { | |||
/** | |||
* Is sharing my mail (link share) enabled ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -219,7 +219,7 @@ export default class Config { | |||
/** | |||
* Get the default days to link shares expiration | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -230,7 +230,7 @@ export default class Config { | |||
/** | |||
* Get the default days to internal shares expiration | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -241,7 +241,7 @@ export default class Config { | |||
/** | |||
* Get the default days to remote shares expiration | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -252,7 +252,7 @@ export default class Config { | |||
/** | |||
* Is resharing allowed ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -263,7 +263,7 @@ export default class Config { | |||
/** | |||
* Is password enforced for mail shares ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -272,7 +272,7 @@ export default class Config { | |||
} | |||
/** | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -283,7 +283,7 @@ export default class Config { | |||
/** | |||
* Is sharing with groups allowed ? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -294,7 +294,7 @@ export default class Config { | |||
/** | |||
* Get the maximum results of a share search | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -306,7 +306,7 @@ export default class Config { | |||
* Get the minimal string length | |||
* to initiate a share search | |||
* | |||
* @returns {int} | |||
* @return {int} | |||
* @readonly | |||
* @memberof Config | |||
*/ | |||
@@ -317,7 +317,7 @@ export default class Config { | |||
/** | |||
* Get the password policy config | |||
* | |||
* @returns {Object} | |||
* @return {object} | |||
* @readonly | |||
* @memberof Config | |||
*/ |
@@ -38,7 +38,7 @@ export default class ExternalLinkActions { | |||
* | |||
* @readonly | |||
* @memberof ExternalLinkActions | |||
* @returns {Object} the data state | |||
* @return {object} the data state | |||
*/ | |||
get state() { | |||
return this._state | |||
@@ -48,8 +48,8 @@ export default class ExternalLinkActions { | |||
* Register a new action for the link share | |||
* Mostly used by the social sharing app. | |||
* | |||
* @param {Object} action new action component to register | |||
* @returns {boolean} | |||
* @param {object} action new action component to register | |||
* @return {boolean} | |||
*/ | |||
registerAction(action) { | |||
console.warn('OCA.Sharing.ExternalLinkActions is deprecated, use OCA.Sharing.ExternalShareAction instead') |
@@ -38,7 +38,7 @@ export default class ExternalShareActions { | |||
* | |||
* @readonly | |||
* @memberof ExternalLinkActions | |||
* @returns {Object} the data state | |||
* @return {object} the data state | |||
*/ | |||
get state() { | |||
return this._state | |||
@@ -47,12 +47,12 @@ export default class ExternalShareActions { | |||
/** | |||
* Register a new option/entry for the a given share type | |||
* | |||
* @param {Object} action new action component to register | |||
* @param {object} action new action component to register | |||
* @param {string} action.id unique action id | |||
* @param {Function} action.data data to bind the component to | |||
* @param {Array} action.shareType list of OC.Share.SHARE_XXX to be mounted on | |||
* @param {Object} action.handlers list of listeners | |||
* @returns {boolean} | |||
* @param {object} action.handlers list of listeners | |||
* @return {boolean} | |||
*/ | |||
registerAction(action) { | |||
// Validate action |
@@ -38,7 +38,7 @@ export default class ShareSearch { | |||
* | |||
* @readonly | |||
* @memberof ShareSearch | |||
* @returns {Object} the data state | |||
* @return {object} the data state | |||
*/ | |||
get state() { | |||
return this._state | |||
@@ -49,14 +49,14 @@ export default class ShareSearch { | |||
* Mostly used by the guests app. | |||
* We should consider deprecation and add results via php ? | |||
* | |||
* @param {Object} result entry to append | |||
* @param {object} result entry to append | |||
* @param {string} [result.user] entry user | |||
* @param {string} result.displayName entry first line | |||
* @param {string} [result.desc] entry second line | |||
* @param {string} [result.icon] entry icon | |||
* @param {function} result.handler function to run on entry selection | |||
* @param {function} [result.condition] condition to add entry or not | |||
* @returns {boolean} | |||
* @param {Function} result.handler function to run on entry selection | |||
* @param {Function} [result.condition] condition to add entry or not | |||
* @return {boolean} | |||
*/ | |||
addNewResult(result) { | |||
if (result.displayName.trim() !== '' |
@@ -31,7 +31,7 @@ const passwordSet = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789' | |||
* request a valid password if password_policy | |||
* is enabled | |||
* | |||
* @returns {string} a valid password | |||
* @return {string} a valid password | |||
*/ | |||
export default async function() { | |||
// password policy is enabled, let's request a pass |
@@ -87,7 +87,7 @@ export default { | |||
* Using this to still show the `new link share` | |||
* button regardless of mail shares | |||
* | |||
* @returns {Array} | |||
* @return {Array} | |||
*/ | |||
hasLinkShares() { | |||
return this.shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK).length > 0 | |||
@@ -96,7 +96,7 @@ export default { | |||
/** | |||
* Do we have any link or email shares? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
hasShares() { | |||
return this.shares.length > 0 |
@@ -144,7 +144,7 @@ export default { | |||
/** | |||
* Is this share shared with me? | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
isSharedWithMe() { | |||
return Object.keys(this.sharedWithMe).length > 0 | |||
@@ -159,7 +159,8 @@ export default { | |||
methods: { | |||
/** | |||
* Update current fileInfo and fetch new data | |||
* @param {Object} fileInfo the current file FileInfo | |||
* | |||
* @param {object} fileInfo the current file FileInfo | |||
*/ | |||
async update(fileInfo) { | |||
this.fileInfo = fileInfo | |||
@@ -246,8 +247,8 @@ export default { | |||
* Process the current shares data | |||
* and init shares[] | |||
* | |||
* @param {Object} share the share ocs api request data | |||
* @param {Object} share.data the request data | |||
* @param {object} share the share ocs api request data | |||
* @param {object} share.data the request data | |||
*/ | |||
processShares({ data }) { | |||
if (data.ocs && data.ocs.data && data.ocs.data.length > 0) { | |||
@@ -268,8 +269,8 @@ export default { | |||
* Process the sharedWithMe share data | |||
* and init sharedWithMe | |||
* | |||
* @param {Object} share the share ocs api request data | |||
* @param {Object} share.data the request data | |||
* @param {object} share the share ocs api request data | |||
* @param {object} share.data the request data | |||
*/ | |||
processSharedWithMe({ data }) { | |||
if (data.ocs && data.ocs.data && data.ocs.data[0]) { |
@@ -31,7 +31,7 @@ | |||
sync: OC.Backbone.davSync, | |||
/** | |||
* @var OCA.Files.FileInfoModel | |||
* @member OCA.Files.FileInfoModel | |||
*/ | |||
_fileInfo: null, | |||
@@ -38,8 +38,8 @@ | |||
/** | |||
* Restores the original file to this revision | |||
* | |||
* @param {Object} [options] options | |||
* @returns {Promise} | |||
* @param {object} [options] options | |||
* @return {Promise} | |||
*/ | |||
revert(options) { | |||
options = options ? _.clone(options) : {} |
@@ -213,8 +213,9 @@ import Template from './templates/template.handlebars'; | |||
/** | |||
* Returns true for files, false for folders. | |||
* | |||
* @param {FileInfo} fileInfo fileInfo | |||
* @returns {bool} true for files, false for folders | |||
* @return {bool} true for files, false for folders | |||
*/ | |||
canDisplay(fileInfo) { | |||
if (!fileInfo) { |
@@ -42,7 +42,7 @@ export default { | |||
selected: this.authorizedGroups | |||
.filter((group) => group.class === this.setting.class) | |||
.map((groupToMap) => this.availableGroups.find((group) => group.gid === groupToMap.group_id)) | |||
.filter((group) => group !== undefined) | |||
.filter((group) => group !== undefined), | |||
} | |||
}, | |||
watch: { | |||
@@ -63,7 +63,7 @@ export default { | |||
logger.error('Unable to modify setting', e) | |||
} | |||
}, | |||
} | |||
}, | |||
} | |||
</script> | |||
@@ -48,7 +48,7 @@ | |||
:open.sync="actionOpen"> | |||
<ActionCheckbox v-if="token.type === 1" | |||
:checked="token.scope.filesystem" | |||
@change.stop.prevent="$emit('toggleScope', token, 'filesystem', !token.scope.filesystem)"> | |||
@change.stop.prevent="$emit('toggle-scope', token, 'filesystem', !token.scope.filesystem)"> | |||
<!-- TODO: add text/longtext with some description --> | |||
{{ t('settings', 'Allow filesystem access') }} | |||
</ActionCheckbox> |
@@ -67,7 +67,7 @@ export default { | |||
methods: { | |||
toggleScope(token, scope, value) { | |||
// Just pass it on | |||
this.$emit('toggleScope', token, scope, value) | |||
this.$emit('toggle-scope', token, scope, value) | |||
}, | |||
rename(token, newName) { | |||
// Just pass it on |
@@ -55,8 +55,9 @@ const confirm = () => { | |||
/** | |||
* Tap into a promise without losing the value | |||
* | |||
* @param {Function} cb the callback | |||
* @returns {any} val the value | |||
* @return {any} val the value | |||
*/ | |||
const tap = cb => val => { | |||
cb(val) |
@@ -85,7 +85,7 @@ export default { | |||
// TODO remove this when not used once the settings layout is updated | |||
marginLeft: window.matchMedia('(min-width: 1600px)').matches | |||
? window.getComputedStyle(document.getElementById('personal-settings-avatar-container')).getPropertyValue('width').trim() | |||
: '0px' | |||
: '0px', | |||
} | |||
}, | |||
@@ -438,7 +438,7 @@ export default { | |||
* Validate quota string to make sure it's a valid human file size | |||
* | |||
* @param {string} quota Quota in readable format '5 GB' | |||
* @returns {Object} | |||
* @return {object} | |||
*/ | |||
validateQuota(quota) { | |||
// only used for new presets sent through @Tag | |||
@@ -550,7 +550,7 @@ export default { | |||
* Create a new group | |||
* | |||
* @param {string} gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
createGroup(gid) { | |||
this.loading.groups = true | |||
@@ -568,8 +568,8 @@ export default { | |||
/** | |||
* If the selected group is the disabled group but the count is 0 | |||
* redirect to the all users page. | |||
* * we only check for 0 because we don't have the count on ldap | |||
* * and we therefore set the usercount to -1 in this specific case | |||
* we only check for 0 because we don't have the count on ldap | |||
* and we therefore set the usercount to -1 in this specific case | |||
*/ | |||
redirectIfDisabled() { | |||
const allGroups = this.$store.getters.getGroups |
@@ -432,10 +432,10 @@ export default { | |||
}, | |||
/** | |||
* Set user displayName | |||
* | |||
* @param {string} displayName The display name | |||
*/ | |||
* Set user displayName | |||
* | |||
* @param {string} displayName The display name | |||
*/ | |||
updateDisplayName() { | |||
const displayName = this.$refs.displayName.value | |||
this.loading.displayName = true | |||
@@ -450,10 +450,10 @@ export default { | |||
}, | |||
/** | |||
* Set user password | |||
* | |||
* @param {string} password The email adress | |||
*/ | |||
* Set user password | |||
* | |||
* @param {string} password The email adress | |||
*/ | |||
updatePassword() { | |||
const password = this.$refs.password.value | |||
this.loading.password = true | |||
@@ -468,10 +468,10 @@ export default { | |||
}, | |||
/** | |||
* Set user mailAddress | |||
* | |||
* @param {string} mailAddress The email adress | |||
*/ | |||
* Set user mailAddress | |||
* | |||
* @param {string} mailAddress The email adress | |||
*/ | |||
updateEmail() { | |||
const mailAddress = this.$refs.mailAddress.value | |||
this.loading.mailAddress = true | |||
@@ -486,10 +486,10 @@ export default { | |||
}, | |||
/** | |||
* Create a new group and add user to it | |||
* | |||
* @param {string} gid Group id | |||
*/ | |||
* Create a new group and add user to it | |||
* | |||
* @param {string} gid Group id | |||
*/ | |||
async createGroup(gid) { | |||
this.loading = { groups: true, subadmins: true } | |||
try { | |||
@@ -505,10 +505,10 @@ export default { | |||
}, | |||
/** | |||
* Add user to group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
* Add user to group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
async addUserGroup(group) { | |||
if (group.canAdd === false) { | |||
return false | |||
@@ -526,10 +526,10 @@ export default { | |||
}, | |||
/** | |||
* Remove user from group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
* Remove user from group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
async removeUserGroup(group) { | |||
if (group.canRemove === false) { | |||
return false | |||
@@ -555,10 +555,10 @@ export default { | |||
}, | |||
/** | |||
* Add user to group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
* Add user to group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
async addUserSubAdmin(group) { | |||
this.loading.subadmins = true | |||
const userid = this.user.id | |||
@@ -576,10 +576,10 @@ export default { | |||
}, | |||
/** | |||
* Remove user from group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
* Remove user from group | |||
* | |||
* @param {object} group Group object | |||
*/ | |||
async removeUserSubAdmin(group) { | |||
this.loading.subadmins = true | |||
const userid = this.user.id | |||
@@ -598,11 +598,11 @@ export default { | |||
}, | |||
/** | |||
* Dispatch quota set request | |||
* | |||
* @param {string|Object} quota Quota in readable format '5 GB' or Object {id: '5 GB', label: '5GB'} | |||
* @returns {string} | |||
*/ | |||
* Dispatch quota set request | |||
* | |||
* @param {string | object} quota Quota in readable format '5 GB' or Object {id: '5 GB', label: '5GB'} | |||
* @return {string} | |||
*/ | |||
async setUserQuota(quota = 'none') { | |||
this.loading.quota = true | |||
// ensure we only send the preset id | |||
@@ -623,11 +623,11 @@ export default { | |||
}, | |||
/** | |||
* Validate quota string to make sure it's a valid human file size | |||
* | |||
* @param {string} quota Quota in readable format '5 GB' | |||
* @returns {Promise|boolean} | |||
*/ | |||
* Validate quota string to make sure it's a valid human file size | |||
* | |||
* @param {string} quota Quota in readable format '5 GB' | |||
* @return {Promise|boolean} | |||
*/ | |||
validateQuota(quota) { | |||
// only used for new presets sent through @Tag | |||
const validQuota = OC.Util.computerFileSize(quota) | |||
@@ -640,11 +640,11 @@ export default { | |||
}, | |||
/** | |||
* Dispatch language set request | |||
* | |||
* @param {Object} lang language object {code:'en', name:'English'} | |||
* @returns {Object} | |||
*/ | |||
* Dispatch language set request | |||
* | |||
* @param {object} lang language object {code:'en', name:'English'} | |||
* @return {object} | |||
*/ | |||
async setUserLanguage(lang) { | |||
this.loading.languages = true | |||
// ensure we only send the preset id | |||
@@ -663,8 +663,8 @@ export default { | |||
}, | |||
/** | |||
* Dispatch new welcome mail request | |||
*/ | |||
* Dispatch new welcome mail request | |||
*/ | |||
sendWelcomeMail() { | |||
this.loading.all = true | |||
this.$store.dispatch('sendWelcomeMail', this.user.id) |
@@ -69,7 +69,7 @@ | |||
v-click-outside="hideMenu" | |||
class="icon-more" | |||
:aria-label="t('settings', 'Toggle user actions menu')" | |||
@click.prevent="$emit('toggleMenu')" /> | |||
@click.prevent="$emit('toggle-menu')" /> | |||
<div class="popovermenu" :class="{ 'open': openedMenu }" :aria-expanded="openedMenu"> | |||
<PopoverMenu :menu="userActions" /> | |||
</div> | |||
@@ -177,7 +177,7 @@ export default { | |||
}, | |||
methods: { | |||
hideMenu() { | |||
this.$emit('hideMenu') | |||
this.$emit('hide-menu') | |||
}, | |||
toggleEdit() { | |||
this.$emit('update:editing', true) |
@@ -86,7 +86,7 @@ export const PROPERTY_READABLE_KEYS_ENUM = Object.freeze({ | |||
/** | |||
* Enum of account setting properties | |||
* | |||
* *Account setting properties unlike account properties do not support scopes* | |||
* Account setting properties unlike account properties do not support scopes* | |||
*/ | |||
export const ACCOUNT_SETTING_PROPERTY_ENUM = Object.freeze({ | |||
LANGUAGE: 'language', | |||
@@ -136,7 +136,7 @@ export const SCOPE_SUFFIX = 'Scope' | |||
/** | |||
* Enum of scope names to properties | |||
* | |||
* *Used for federation control* | |||
* Used for federation control* | |||
*/ | |||
export const SCOPE_PROPERTY_ENUM = Object.freeze({ | |||
[SCOPE_ENUM.PRIVATE]: { | |||
@@ -182,7 +182,7 @@ export const VERIFICATION_ENUM = Object.freeze({ | |||
/** | |||
* Email validation regex | |||
* | |||
* *Sourced from https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js/blob/71e62ca48841d2246a1b531e7e84f5a01f15e615/src/regexp/ascii.ts* | |||
* Sourced from https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js/blob/71e62ca48841d2246a1b531e7e84f5a01f15e615/src/regexp/ascii.ts* | |||
*/ | |||
// eslint-disable-next-line no-control-regex | |||
export const VALIDATE_EMAIL_REGEX = /^(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){255,})(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){65,}@)(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22))(?:\.(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\]))$/i |
@@ -159,7 +159,7 @@ export default { | |||
* | |||
* @param {string} user The user name | |||
* @param {int} size Size integer, default 32 | |||
* @returns {string} | |||
* @return {string} | |||
*/ | |||
generateAvatar(user, size = 32) { | |||
return generateUrl( |
@@ -31,9 +31,9 @@ import { ACCOUNT_PROPERTY_ENUM, SCOPE_SUFFIX } from '../../constants/AccountProp | |||
* Save the primary email of the user | |||
* | |||
* @param {string} email the primary email | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const savePrimaryEmail = async(email) => { | |||
export const savePrimaryEmail = async (email) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}', { userId }) | |||
@@ -50,12 +50,12 @@ export const savePrimaryEmail = async(email) => { | |||
/** | |||
* Save an additional email of the user | |||
* | |||
* *Will be appended to the user's additional emails* | |||
* Will be appended to the user's additional emails* | |||
* | |||
* @param {string} email the additional email | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const saveAdditionalEmail = async(email) => { | |||
export const saveAdditionalEmail = async (email) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}', { userId }) | |||
@@ -73,9 +73,9 @@ export const saveAdditionalEmail = async(email) => { | |||
* Save the notification email of the user | |||
* | |||
* @param {string} email the notification email | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const saveNotificationEmail = async(email) => { | |||
export const saveNotificationEmail = async (email) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}', { userId }) | |||
@@ -93,9 +93,9 @@ export const saveNotificationEmail = async(email) => { | |||
* Remove an additional email of the user | |||
* | |||
* @param {string} email the additional email | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const removeAdditionalEmail = async(email) => { | |||
export const removeAdditionalEmail = async (email) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}/{collection}', { userId, collection: ACCOUNT_PROPERTY_ENUM.EMAIL_COLLECTION }) | |||
@@ -114,9 +114,9 @@ export const removeAdditionalEmail = async(email) => { | |||
* | |||
* @param {string} prevEmail the additional email to be updated | |||
* @param {string} newEmail the new additional email | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const updateAdditionalEmail = async(prevEmail, newEmail) => { | |||
export const updateAdditionalEmail = async (prevEmail, newEmail) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}/{collection}', { userId, collection: ACCOUNT_PROPERTY_ENUM.EMAIL_COLLECTION }) | |||
@@ -134,9 +134,9 @@ export const updateAdditionalEmail = async(prevEmail, newEmail) => { | |||
* Save the federation scope for the primary email of the user | |||
* | |||
* @param {string} scope the federation scope | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const savePrimaryEmailScope = async(scope) => { | |||
export const savePrimaryEmailScope = async (scope) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}', { userId }) | |||
@@ -155,9 +155,9 @@ export const savePrimaryEmailScope = async(scope) => { | |||
* | |||
* @param {string} email the additional email | |||
* @param {string} scope the federation scope | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const saveAdditionalEmailScope = async(email, scope) => { | |||
export const saveAdditionalEmailScope = async (email, scope) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}/{collectionScope}', { userId, collectionScope: `${ACCOUNT_PROPERTY_ENUM.EMAIL_COLLECTION}${SCOPE_SUFFIX}` }) | |||
@@ -32,9 +32,9 @@ import { SCOPE_SUFFIX } from '../../constants/AccountPropertyConstants' | |||
* | |||
* @param {string} accountProperty the account property | |||
* @param {string|boolean} value the primary value | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const savePrimaryAccountProperty = async(accountProperty, value) => { | |||
export const savePrimaryAccountProperty = async (accountProperty, value) => { | |||
// TODO allow boolean values on backend route handler | |||
// Convert boolean to string for compatibility | |||
if (typeof value === 'boolean') { | |||
@@ -59,9 +59,9 @@ export const savePrimaryAccountProperty = async(accountProperty, value) => { | |||
* | |||
* @param {string} accountProperty the account property | |||
* @param {string} scope the federation scope | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const savePrimaryAccountPropertyScope = async(accountProperty, scope) => { | |||
export const savePrimaryAccountPropertyScope = async (accountProperty, scope) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('cloud/users/{userId}', { userId }) | |||
@@ -30,9 +30,9 @@ import confirmPassword from '@nextcloud/password-confirmation' | |||
* | |||
* @param {string} paramId the profile parameter ID | |||
* @param {string} visibility the visibility | |||
* @returns {object} | |||
* @return {object} | |||
*/ | |||
export const saveProfileParameterVisibility = async(paramId, visibility) => { | |||
export const saveProfileParameterVisibility = async (paramId, visibility) => { | |||
const userId = getCurrentUser().uid | |||
const url = generateOcsUrl('/profile/{userId}', { userId }) | |||
@@ -23,6 +23,9 @@ | |||
import axios from '@nextcloud/axios' | |||
import { generateUrl } from '@nextcloud/router' | |||
/** | |||
* | |||
*/ | |||
export async function startRegistration() { | |||
const url = generateUrl('/settings/api/personal/webauthn/registration') | |||
@@ -30,6 +33,10 @@ export async function startRegistration() { | |||
return resp.data | |||
} | |||
/** | |||
* @param name | |||
* @param data | |||
*/ | |||
export async function finishRegistration(name, data) { | |||
const url = generateUrl('/settings/api/personal/webauthn/registration') | |||
@@ -37,6 +44,9 @@ export async function finishRegistration(name, data) { | |||
return resp.data | |||
} | |||
/** | |||
* @param id | |||
*/ | |||
export async function removeRegistration(id) { | |||
const url = generateUrl(`/settings/api/personal/webauthn/registration/${id}`) | |||
@@ -62,7 +62,7 @@ export default { | |||
* .catch((error) => {throw error;}); | |||
* }).catch((error) => {requireAdmin OR API failure}); | |||
* | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
requireAdmin() { | |||
return confirmPassword() |
@@ -29,10 +29,10 @@ const mutations = {} | |||
const getters = {} | |||
const actions = { | |||
/** | |||
* Set application config in database | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* Set application config in database | |||
* | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.app Application name | |||
* @param {boolean} options.key Config key | |||
* @param {boolean} options.value Value to set |
@@ -163,7 +163,8 @@ const mutations = { | |||
/** | |||
* Reset users list | |||
* @param {Object} state the store state | |||
* | |||
* @param {object} state the store state | |||
*/ | |||
resetUsers(state) { | |||
state.users = [] | |||
@@ -204,13 +205,13 @@ const actions = { | |||
/** | |||
* Get all users with full details | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {int} options.offset List offset to request | |||
* @param {int} options.limit List number to return from offset | |||
* @param {string} options.search Search amongst users | |||
* @param {string} options.group Get users from group | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
getUsers(context, { offset, limit, search, group }) { | |||
if (searchRequestCancelSource) { | |||
@@ -273,11 +274,12 @@ const actions = { | |||
/** | |||
* Get all users with full details | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {int} options.offset List offset to request | |||
* @param {int} options.limit List number to return from offset | |||
* @returns {Promise} | |||
* @param options.search | |||
* @return {Promise} | |||
*/ | |||
getUsersFromList(context, { offset, limit, search }) { | |||
search = typeof search === 'string' ? search : '' | |||
@@ -295,11 +297,12 @@ const actions = { | |||
/** | |||
* Get all users with full details from a groupid | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {int} options.offset List offset to request | |||
* @param {int} options.limit List number to return from offset | |||
* @returns {Promise} | |||
* @param options.groupid | |||
* @return {Promise} | |||
*/ | |||
getUsersFromGroup(context, { groupid, offset, limit }) { | |||
return api.get(generateOcsUrl('cloud/users/{groupId}/details?offset={offset}&limit={limit}', { groupId: encodeURIComponent(groupid), offset, limit })) | |||
@@ -318,9 +321,9 @@ const actions = { | |||
/** | |||
* Add group | |||
* | |||
* @param {Object} context store context | |||
* @param {object} context store context | |||
* @param {string} gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
addGroup(context, gid) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -341,9 +344,9 @@ const actions = { | |||
/** | |||
* Remove group | |||
* | |||
* @param {Object} context store context | |||
* @param {object} context store context | |||
* @param {string} gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
removeGroup(context, gid) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -356,11 +359,11 @@ const actions = { | |||
/** | |||
* Add user to group | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {string} options.gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
addUserGroup(context, { userid, gid }) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -373,11 +376,11 @@ const actions = { | |||
/** | |||
* Remove user from group | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {string} options.gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
removeUserGroup(context, { userid, gid }) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -395,11 +398,11 @@ const actions = { | |||
/** | |||
* Add user to group admin | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {string} options.gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
addUserSubAdmin(context, { userid, gid }) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -412,11 +415,11 @@ const actions = { | |||
/** | |||
* Remove user from group admin | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {string} options.gid Group id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
removeUserSubAdmin(context, { userid, gid }) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -429,9 +432,9 @@ const actions = { | |||
/** | |||
* Mark all user devices for remote wipe | |||
* | |||
* @param {Object} context store context | |||
* @param {object} context store context | |||
* @param {string} userid User id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
wipeUserDevices(context, userid) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -443,9 +446,9 @@ const actions = { | |||
/** | |||
* Delete a user | |||
* | |||
* @param {Object} context store context | |||
* @param {object} context store context | |||
* @param {string} userid User id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
deleteUser(context, userid) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -458,8 +461,8 @@ const actions = { | |||
/** | |||
* Add a user | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {string} options.password User password | |||
* @param {string} options.displayName User display name | |||
@@ -467,7 +470,10 @@ const actions = { | |||
* @param {string} options.groups User groups | |||
* @param {string} options.subadmin User subadmin groups | |||
* @param {string} options.quota User email | |||
* @returns {Promise} | |||
* @param context.commit | |||
* @param context.dispatch | |||
* @param options.language | |||
* @return {Promise} | |||
*/ | |||
addUser({ commit, dispatch }, { userid, password, displayName, email, groups, subadmin, quota, language }) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -483,9 +489,9 @@ const actions = { | |||
/** | |||
* Get user data and commit addition | |||
* | |||
* @param {Object} context store context | |||
* @param {object} context store context | |||
* @param {string} userid User id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
addUserData(context, userid) { | |||
return api.requireAdmin().then((response) => { | |||
@@ -495,13 +501,14 @@ const actions = { | |||
}).catch((error) => context.commit('API_FAILURE', { userid, error })) | |||
}, | |||
/** Enable or disable user | |||
/** | |||
* Enable or disable user | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {boolean} options.enabled User enablement status | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
enableDisableUser(context, { userid, enabled = true }) { | |||
const userStatus = enabled ? 'enable' : 'disable' | |||
@@ -515,12 +522,12 @@ const actions = { | |||
/** | |||
* Edit user data | |||
* | |||
* @param {Object} context store context | |||
* @param {Object} options destructuring object | |||
* @param {object} context store context | |||
* @param {object} options destructuring object | |||
* @param {string} options.userid User id | |||
* @param {string} options.key User field to edit | |||
* @param {string} options.value Value of the change | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
setUserData(context, { userid, key, value }) { | |||
const allowedEmpty = ['email', 'displayname'] | |||
@@ -545,9 +552,9 @@ const actions = { | |||
/** | |||
* Send welcome mail | |||
* | |||
* @param {Object} context store context | |||
* @param {object} context store context | |||
* @param {string} userid User id | |||
* @returns {Promise} | |||
* @return {Promise} | |||
*/ | |||
sendWelcomeMail(context, userid) { | |||
return api.requireAdmin().then((response) => { |
@@ -31,10 +31,10 @@ import { VALIDATE_EMAIL_REGEX } from '../constants/AccountPropertyConstants' | |||
/** | |||
* Validate the string input | |||
* | |||
* *Generic validator just to check that input is not an empty string* | |||
* Generic validator just to check that input is not an empty string* | |||
* | |||
* @param {string} input the input | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
export function validateStringInput(input) { | |||
return input !== '' | |||
@@ -43,12 +43,12 @@ export function validateStringInput(input) { | |||
/** | |||
* Validate the email input | |||
* | |||
* *Compliant with PHP core FILTER_VALIDATE_EMAIL validator* | |||
* Compliant with PHP core FILTER_VALIDATE_EMAIL validator* | |||
* | |||
* *Reference implementation https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js/blob/71e62ca48841d2246a1b531e7e84f5a01f15e615/src/index.ts* | |||
* Reference implementation https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js/blob/71e62ca48841d2246a1b531e7e84f5a01f15e615/src/index.ts* | |||
* | |||
* @param {string} input the input | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
export function validateEmail(input) { | |||
return typeof input === 'string' | |||
@@ -62,7 +62,7 @@ export function validateEmail(input) { | |||
* Validate the language input | |||
* | |||
* @param {object} input the input | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
export function validateLanguage(input) { | |||
return input.code !== '' | |||
@@ -74,7 +74,7 @@ export function validateLanguage(input) { | |||
* Validate boolean input | |||
* | |||
* @param {boolean} input the input | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
export function validateBoolean(input) { | |||
return typeof input === 'boolean' |
@@ -390,7 +390,7 @@ export default { | |||
/** | |||
* Dispatch default quota set request | |||
* | |||
* @param {string|Object} quota Quota in readable format '5 GB' or Object {id: '5 GB', label: '5GB'} | |||
* @param {string | object} quota Quota in readable format '5 GB' or Object {id: '5 GB', label: '5GB'} | |||
*/ | |||
setDefaultQuota(quota = 'none') { | |||
this.$store.dispatch('setAppConfig', { | |||
@@ -410,7 +410,7 @@ export default { | |||
* Validate quota string to make sure it's a valid human file size | |||
* | |||
* @param {string} quota Quota in readable format '5 GB' | |||
* @returns {Promise|boolean} | |||
* @return {Promise|boolean} | |||
*/ | |||
validateQuota(quota) { | |||
// only used for new presets sent through @Tag | |||
@@ -429,7 +429,7 @@ export default { | |||
* @param {string} icon the icon class | |||
* @param {string} text the text to display | |||
* @param {Function} action the function to run | |||
* @returns {Array} | |||
* @return {Array} | |||
*/ | |||
registerAction(icon, text, action) { | |||
this.externalActions.push({ | |||
@@ -484,8 +484,9 @@ export default { | |||
/** | |||
* Format a group to a menu entry | |||
* @param {Object} group the group | |||
* @returns {Object} | |||
* | |||
* @param {object} group the group | |||
* @return {object} | |||
*/ | |||
formatGroupMenu(group) { | |||
const item = {} |
@@ -30,7 +30,7 @@ | |||
* @classdesc SystemTags file list. | |||
* Contains a list of files filtered by system tags. | |||
* | |||
* @param {Object} $el container element with existing markup for the #controls and a table | |||
* @param {object} $el container element with existing markup for the #controls and a table | |||
* @param {Array} [options] map of options, see other parameters | |||
* @param {Array.<string>} [options.systemTagIds] array of system tag ids to | |||
* filter by | |||
@@ -60,8 +60,8 @@ | |||
/** | |||
* @private | |||
* @param {Object} $el container element | |||
* @param {Object} [options] map of options, see other parameters | |||
* @param {object} $el container element | |||
* @param {object} [options] map of options, see other parameters | |||
*/ | |||
initialize($el, options) { | |||
OCA.Files.FileList.prototype.initialize.apply(this, arguments) | |||
@@ -190,7 +190,7 @@ | |||
/** | |||
* Autocomplete function for dropdown results | |||
* | |||
* @param {Object} query select2 query object | |||
* @param {object} query select2 query object | |||
*/ | |||
_queryTagsAutocomplete(query) { | |||
OC.SystemTags.collection.fetch({ |
@@ -26,6 +26,9 @@ | |||
(function(OCA) { | |||
/** | |||
* @param model | |||
*/ | |||
function modelToSelection(model) { | |||
const data = model.toJSON() | |||
if (!OC.isUserAdmin() && !data.canAssign) { | |||
@@ -82,7 +85,8 @@ | |||
/** | |||
* Event handler whenever a tag was selected | |||
* @param {Object} tag the tag to create | |||
* | |||
* @param {object} tag the tag to create | |||
*/ | |||
_onSelectTag(tag) { | |||
// create a mapping entry for this tag |
@@ -25,6 +25,9 @@ | |||
import Axios from '@nextcloud/axios' | |||
import { generateUrl } from '@nextcloud/router' | |||
/** | |||
* | |||
*/ | |||
export function generateCodes() { | |||
const url = generateUrl('/apps/twofactor_backupcodes/settings/create') | |||
@@ -21,6 +21,9 @@ | |||
* | |||
*/ | |||
/** | |||
* @param data | |||
*/ | |||
export function print(data) { | |||
const name = OC.theme.name || 'Nextcloud' | |||
const newTab = window.open('', t('twofactor_backupcodes', '{name} backup codes', { name })) |
@@ -372,8 +372,8 @@ export default { | |||
methods: { | |||
/** | |||
* Creates a new authentication token and loads the updater URL | |||
*/ | |||
* Creates a new authentication token and loads the updater URL | |||
*/ | |||
clickUpdaterButton() { | |||
$.ajax({ | |||
url: generateUrl('/apps/updatenotification/credentials'), |
@@ -99,7 +99,7 @@ export default { | |||
/** | |||
* The profile page link | |||
* | |||
* @returns {String|null} | |||
* @return {string | null} | |||
*/ | |||
profilePageLink() { | |||
if (this.profileEnabled) { | |||
@@ -194,7 +194,7 @@ export default { | |||
/** | |||
* Sends the status heartbeat to the server | |||
* | |||
* @returns {Promise<void>} | |||
* @return {Promise<void>} | |||
* @private | |||
*/ | |||
async _backgroundHeartbeat() { |
@@ -59,7 +59,7 @@ export default { | |||
/** | |||
* Returns an object of the currently selected option | |||
* | |||
* @returns {Object} | |||
* @return {object} | |||
*/ | |||
option() { | |||
return { | |||
@@ -72,14 +72,14 @@ export default { | |||
/** | |||
* Triggered when the user selects a new option. | |||
* | |||
* @param {Object=} option The new selected option | |||
* @param {object=} option The new selected option | |||
*/ | |||
select(option) { | |||
if (!option) { | |||
return | |||
} | |||
this.$emit('selectClearAt', option.clearAt) | |||
this.$emit('select-clear-at', option.clearAt) | |||
}, | |||
}, | |||
} |
@@ -55,7 +55,7 @@ export default { | |||
/** | |||
* Indicator whether the predefined statuses have already been loaded | |||
* | |||
* @returns {boolean} | |||
* @return {boolean} | |||
*/ | |||
hasLoaded() { | |||
return this.predefinedStatuses.length > 0 | |||
@@ -72,10 +72,10 @@ export default { | |||
/** | |||
* Emits an event when the user selects a status | |||
* | |||
* @param {Object} status The selected status | |||
* @param {object} status The selected status | |||
*/ | |||
selectStatus(status) { | |||
this.$emit('selectStatus', status) | |||
this.$emit('select-status', status) | |||
}, | |||
}, | |||
} |
@@ -110,7 +110,7 @@ export default { | |||
/** | |||
* Returns the user-set icon or a smiley in case no icon is set | |||
* | |||
* @returns {String} | |||
* @return {string} | |||
*/ | |||
visibleIcon() { | |||
return this.icon || '😀' | |||
@@ -142,7 +142,7 @@ export default { | |||
/** | |||
* Sets a new icon | |||
* | |||
* @param {String} icon The new icon | |||
* @param {string} icon The new icon | |||
*/ | |||
setIcon(icon) { | |||
this.messageId = null | |||
@@ -154,7 +154,7 @@ export default { | |||
/** | |||
* Sets a new message | |||
* | |||
* @param {String} message The new message | |||
* @param {string} message The new message | |||
*/ | |||
setMessage(message) { | |||
this.messageId = null | |||
@@ -163,7 +163,7 @@ export default { | |||
/** | |||
* Sets a new clearAt value | |||
* | |||
* @param {Object} clearAt The new clearAt object | |||
* @param {object} clearAt The new clearAt object | |||
*/ | |||
setClearAt(clearAt) { | |||
this.clearAt = clearAt | |||
@@ -171,7 +171,7 @@ export default { | |||
/** | |||
* Sets new icon/message/clearAt based on a predefined message | |||
* | |||
* @param {Object} status The predefined status object | |||
* @param {object} status The predefined status object | |||
*/ | |||
selectPredefinedMessage(status) { | |||
this.messageId = status.id | |||
@@ -182,7 +182,7 @@ export default { | |||
/** | |||
* Saves the status and closes the | |||
* | |||
* @returns {Promise<void>} | |||
* @return {Promise<void>} | |||
*/ | |||
async saveStatus() { | |||
if (this.isSavingStatus) { | |||
@@ -216,7 +216,7 @@ export default { | |||
}, | |||
/** | |||
* | |||
* @returns {Promise<void>} | |||
* @return {Promise<void>} | |||
*/ | |||
async clearStatus() { | |||
try { |
@@ -27,8 +27,8 @@ import { dateFactory } from '../services/dateService' | |||
/** | |||
* Formats a clearAt object to be human readable | |||
* | |||
* @param {Object} clearAt The clearAt object | |||
* @returns {string|null} | |||
* @param {object} clearAt The clearAt object | |||
* @return {string|null} | |||
*/ | |||
const clearAtFilter = (clearAt) => { | |||
if (clearAt === null) { |
@@ -35,7 +35,7 @@ export default { | |||
/** | |||
* The message displayed in the top right corner | |||
* | |||
* @returns {String} | |||
* @return {string} | |||
*/ | |||
visibleMessage() { | |||
if (this.customIcon && this.customMessage) { | |||
@@ -71,7 +71,7 @@ export default { | |||
/** | |||
* The status indicator icon | |||
* | |||
* @returns {String|null} | |||
* @return {string | null} | |||
*/ | |||
statusIcon() { | |||
switch (this.statusType) { | |||
@@ -97,7 +97,7 @@ export default { | |||
/** | |||
* Changes the user-status | |||
* | |||
* @param {String} statusType (online / away / dnd / invisible) | |||
* @param {string} statusType (online / away / dnd / invisible) | |||
*/ | |||
async changeStatus(statusType) { | |||
try { |
@@ -25,7 +25,7 @@ import { translate as t } from '@nextcloud/l10n' | |||
/** | |||
* Returns an array | |||
* | |||
* @returns {Object[]} | |||
* @return {object[]} | |||
*/ | |||
const getAllClearAtOptions = () => { | |||
return [{ |
@@ -28,8 +28,8 @@ import moment from '@nextcloud/moment' | |||
/** | |||
* Calculates the actual clearAt timestamp | |||
* | |||
* @param {Object|null} clearAt The clear-at config | |||
* @returns {Number|null} | |||
* @param {object | null} clearAt The clear-at config | |||
* @return {number | null} | |||
*/ | |||
const getTimestampForClearAt = (clearAt) => { | |||
if (clearAt === null) { |
@@ -26,10 +26,10 @@ import { generateUrl } from '@nextcloud/router' | |||
/** | |||
* Sends a heartbeat | |||
* | |||
* @param {Boolean} isAway Whether or not the user is active | |||
* @returns {Promise<void>} | |||
* @param {boolean} isAway Whether or not the user is active | |||
* @return {Promise<void>} | |||
*/ | |||
const sendHeartbeat = async(isAway) => { | |||
const sendHeartbeat = async (isAway) => { | |||
const url = generateUrl('/apps/user_status/heartbeat') | |||
const response = await HttpClient.put(url, { | |||
status: isAway ? 'away' : 'online', |
@@ -26,9 +26,9 @@ import { generateOcsUrl } from '@nextcloud/router' | |||
/** | |||
* Fetches all predefined statuses from the server | |||
* | |||
* @returns {Promise<void>} | |||
* @return {Promise<void>} | |||
*/ | |||
const fetchAllPredefinedStatuses = async() => { | |||
const fetchAllPredefinedStatuses = async () => { | |||
const url = generateOcsUrl('apps/user_status/api/v1/predefined_statuses?format=json') | |||
const response = await HttpClient.get(url) | |||
@@ -26,7 +26,7 @@ import { translate as t } from '@nextcloud/l10n' | |||
/** | |||
* Returns a list of all user-definable statuses | |||
* | |||
* @returns {Object[]} | |||
* @return {object[]} | |||
*/ | |||
const getAllStatusOptions = () => { | |||
return [{ |
@@ -26,9 +26,9 @@ import { generateOcsUrl } from '@nextcloud/router' | |||
/** | |||
* Fetches the current user-status | |||
* | |||
* @returns {Promise<Object>} | |||
* @return {Promise<object>} | |||
*/ | |||
const fetchCurrentStatus = async() => { | |||
const fetchCurrentStatus = async () => { | |||
const url = generateOcsUrl('apps/user_status/api/v1/user_status') | |||
const response = await HttpClient.get(url) | |||
@@ -38,10 +38,10 @@ const fetchCurrentStatus = async() => { | |||
/** | |||
* Sets the status | |||
* | |||
* @param {String} statusType The status (online / away / dnd / invisible) | |||
* @returns {Promise<void>} | |||
* @param {string} statusType The status (online / away / dnd / invisible) | |||
* @return {Promise<void>} | |||
*/ | |||
const setStatus = async(statusType) => { | |||
const setStatus = async (statusType) => { | |||
const url = generateOcsUrl('apps/user_status/api/v1/user_status/status') | |||
await HttpClient.put(url, { | |||
statusType, | |||
@@ -51,11 +51,11 @@ const setStatus = async(statusType) => { | |||
/** | |||
* Sets a message based on our predefined statuses | |||
* | |||
* @param {String} messageId The id of the message, taken from predefined status service | |||
* @param {Number|null} clearAt When to automatically clean the status | |||
* @returns {Promise<void>} | |||
* @param {string} messageId The id of the message, taken from predefined status service | |||
* @param {number | null} clearAt When to automatically clean the status | |||
* @return {Promise<void>} | |||
*/ | |||
const setPredefinedMessage = async(messageId, clearAt = null) => { | |||
const setPredefinedMessage = async (messageId, clearAt = null) => { | |||
const url = generateOcsUrl('apps/user_status/api/v1/user_status/message/predefined?format=json') | |||
await HttpClient.put(url, { | |||
messageId, | |||
@@ -66,12 +66,12 @@ const setPredefinedMessage = async(messageId, clearAt = null) => { | |||
/** | |||
* Sets a custom message | |||
* | |||
* @param {String} message The user-defined message | |||
* @param {String|null} statusIcon The user-defined icon | |||
* @param {Number|null} clearAt When to automatically clean the status | |||
* @returns {Promise<void>} | |||
* @param {string} message The user-defined message | |||
* @param {string | null} statusIcon The user-defined icon | |||
* @param {number | null} clearAt When to automatically clean the status | |||
* @return {Promise<void>} | |||
*/ | |||
const setCustomMessage = async(message, statusIcon = null, clearAt = null) => { | |||
const setCustomMessage = async (message, statusIcon = null, clearAt = null) => { | |||
const url = generateOcsUrl('apps/user_status/api/v1/user_status/message/custom?format=json') | |||
await HttpClient.put(url, { | |||
message, | |||
@@ -83,9 +83,9 @@ const setCustomMessage = async(message, statusIcon = null, clearAt = null) => { | |||
/** | |||
* Clears the current status of the user | |||
* | |||
* @returns {Promise<void>} | |||
* @return {Promise<void>} | |||
*/ | |||
const clearMessage = async() => { | |||
const clearMessage = async () => { | |||
const url = generateOcsUrl('apps/user_status/api/v1/user_status/message?format=json') | |||
await HttpClient.delete(url) | |||
} |
@@ -31,8 +31,8 @@ const mutations = { | |||
/** | |||
* Adds a predefined status to the state | |||
* | |||
* @param {Object} state The Vuex state | |||
* @param {Object} status The status to add | |||
* @param {object} state The Vuex state | |||
* @param {object} status The status to add | |||
*/ | |||
addPredefinedStatus(state, status) { | |||
state.predefinedStatuses.push(status) | |||
@@ -46,8 +46,9 @@ const actions = { | |||
/** | |||
* Loads all predefined statuses from the server | |||
* | |||
* @param {Object} vuex The Vuex components | |||
* @param {object} vuex The Vuex components | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param vuex.state | |||
*/ | |||
async loadAllPredefinedStatuses({ state, commit }) { | |||
if (state.predefinedStatuses.length > 0) { |
@@ -55,9 +55,9 @@ const mutations = { | |||
/** | |||
* Sets a new status | |||
* | |||
* @param {Object} state The Vuex state | |||
* @param {Object} data The destructuring object | |||
* @param {String} data.statusType The new status type | |||
* @param {object} state The Vuex state | |||
* @param {object} data The destructuring object | |||
* @param {string} data.statusType The new status type | |||
*/ | |||
setStatus(state, { statusType }) { | |||
state.status = statusType | |||
@@ -67,12 +67,12 @@ const mutations = { | |||
/** | |||
* Sets a message using a predefined message | |||
* | |||
* @param {Object} state The Vuex state | |||
* @param {Object} data The destructuring object | |||
* @param {String} data.messageId The messageId | |||
* @param {Number|null} data.clearAt When to automatically clear the status | |||
* @param {String} data.message The message | |||
* @param {String} data.icon The icon | |||
* @param {object} state The Vuex state | |||
* @param {object} data The destructuring object | |||
* @param {string} data.messageId The messageId | |||
* @param {number | null} data.clearAt When to automatically clear the status | |||
* @param {string} data.message The message | |||
* @param {string} data.icon The icon | |||
*/ | |||
setPredefinedMessage(state, { messageId, clearAt, message, icon }) { | |||
state.messageId = messageId | |||
@@ -86,11 +86,11 @@ const mutations = { | |||
/** | |||
* Sets a custom message | |||
* | |||
* @param {Object} state The Vuex state | |||
* @param {Object} data The destructuring object | |||
* @param {String} data.message The message | |||
* @param {String} data.icon The icon | |||
* @param {Number} data.clearAt When to automatically clear the status | |||
* @param {object} state The Vuex state | |||
* @param {object} data The destructuring object | |||
* @param {string} data.message The message | |||
* @param {string} data.icon The icon | |||
* @param {number} data.clearAt When to automatically clear the status | |||
*/ | |||
setCustomMessage(state, { message, icon, clearAt }) { | |||
state.messageId = null | |||
@@ -104,7 +104,7 @@ const mutations = { | |||
/** | |||
* Clears the status | |||
* | |||
* @param {Object} state The Vuex state | |||
* @param {object} state The Vuex state | |||
*/ | |||
clearMessage(state) { | |||
state.messageId = null | |||
@@ -118,14 +118,14 @@ const mutations = { | |||
/** | |||
* Loads the status from initial state | |||
* | |||
* @param {Object} state The Vuex state | |||
* @param {Object} data The destructuring object | |||
* @param {String} data.status The status type | |||
* @param {Boolean} data.statusIsUserDefined Whether or not this status is user-defined | |||
* @param {String} data.message The message | |||
* @param {String} data.icon The icon | |||
* @param {Number} data.clearAt When to automatically clear the status | |||
* @param {Boolean} data.messageIsPredefined Whether or not the message is predefined | |||
* @param {object} state The Vuex state | |||
* @param {object} data The destructuring object | |||
* @param {string} data.status The status type | |||
* @param {boolean} data.statusIsUserDefined Whether or not this status is user-defined | |||
* @param {string} data.message The message | |||
* @param {string} data.icon The icon | |||
* @param {number} data.clearAt When to automatically clear the status | |||
* @param {boolean} data.messageIsPredefined Whether or not the message is predefined | |||
* @param {string} data.messageId The id of the predefined message | |||
*/ | |||
loadStatusFromServer(state, { status, statusIsUserDefined, message, icon, clearAt, messageIsPredefined, messageId }) { | |||
@@ -146,12 +146,12 @@ const actions = { | |||
/** | |||
* Sets a new status | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param {Object} vuex.state The Vuex state object | |||
* @param {Object} data The data destructuring object | |||
* @param {String} data.statusType The new status type | |||
* @returns {Promise<void>} | |||
* @param {object} vuex.state The Vuex state object | |||
* @param {object} data The data destructuring object | |||
* @param {string} data.statusType The new status type | |||
* @return {Promise<void>} | |||
*/ | |||
async setStatus({ commit, state }, { statusType }) { | |||
await setStatus(statusType) | |||
@@ -170,11 +170,11 @@ const actions = { | |||
* This doesn't trigger another 'user_status:status.updated' | |||
* event. | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param {Object} vuex.state The Vuex state object | |||
* @param {String} status The new status | |||
* @returns {Promise<void>} | |||
* @param {object} vuex.state The Vuex state object | |||
* @param {string} status The new status | |||
* @return {Promise<void>} | |||
*/ | |||
async setStatusFromObject({ commit, state }, status) { | |||
commit('loadStatusFromServer', status) | |||
@@ -183,14 +183,14 @@ const actions = { | |||
/** | |||
* Sets a message using a predefined message | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param {Object} vuex.state The Vuex state object | |||
* @param {Object} vuex.rootState The Vuex root state | |||
* @param {Object} data The data destructuring object | |||
* @param {String} data.messageId The messageId | |||
* @param {Object|null} data.clearAt When to automatically clear the status | |||
* @returns {Promise<void>} | |||
* @param {object} vuex.state The Vuex state object | |||
* @param {object} vuex.rootState The Vuex root state | |||
* @param {object} data The data destructuring object | |||
* @param {string} data.messageId The messageId | |||
* @param {object | null} data.clearAt When to automatically clear the status | |||
* @return {Promise<void>} | |||
*/ | |||
async setPredefinedMessage({ commit, rootState, state }, { messageId, clearAt }) { | |||
const resolvedClearAt = getTimestampForClearAt(clearAt) | |||
@@ -212,14 +212,14 @@ const actions = { | |||
/** | |||
* Sets a custom message | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param {Object} vuex.state The Vuex state object | |||
* @param {Object} data The data destructuring object | |||
* @param {String} data.message The message | |||
* @param {String} data.icon The icon | |||
* @param {Object|null} data.clearAt When to automatically clear the status | |||
* @returns {Promise<void>} | |||
* @param {object} vuex.state The Vuex state object | |||
* @param {object} data The data destructuring object | |||
* @param {string} data.message The message | |||
* @param {string} data.icon The icon | |||
* @param {object | null} data.clearAt When to automatically clear the status | |||
* @return {Promise<void>} | |||
*/ | |||
async setCustomMessage({ commit, state }, { message, icon, clearAt }) { | |||
const resolvedClearAt = getTimestampForClearAt(clearAt) | |||
@@ -238,10 +238,10 @@ const actions = { | |||
/** | |||
* Clears the status | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param {Object} vuex.state The Vuex state object | |||
* @returns {Promise<void>} | |||
* @param {object} vuex.state The Vuex state object | |||
* @return {Promise<void>} | |||
*/ | |||
async clearMessage({ commit, state }) { | |||
await clearMessage() | |||
@@ -258,9 +258,9 @@ const actions = { | |||
/** | |||
* Re-fetches the status from the server | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @returns {Promise<void>} | |||
* @return {Promise<void>} | |||
*/ | |||
async reFetchStatusFromServer({ commit }) { | |||
const status = await fetchCurrentStatus() | |||
@@ -270,17 +270,17 @@ const actions = { | |||
/** | |||
* Stores the status we got in the reply of the heartbeat | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
* @param {Object} status The data destructuring object | |||
* @param {String} status.status The status type | |||
* @param {Boolean} status.statusIsUserDefined Whether or not this status is user-defined | |||
* @param {String} status.message The message | |||
* @param {String} status.icon The icon | |||
* @param {Number} status.clearAt When to automatically clear the status | |||
* @param {Boolean} status.messageIsPredefined Whether or not the message is predefined | |||
* @param {String} status.messageId The id of the predefined message | |||
* @returns {Promise<void>} | |||
* @param {object} status The data destructuring object | |||
* @param {string} status.status The status type | |||
* @param {boolean} status.statusIsUserDefined Whether or not this status is user-defined | |||
* @param {string} status.message The message | |||
* @param {string} status.icon The icon | |||
* @param {number} status.clearAt When to automatically clear the status | |||
* @param {boolean} status.messageIsPredefined Whether or not the message is predefined | |||
* @param {string} status.messageId The id of the predefined message | |||
* @return {Promise<void>} | |||
*/ | |||
async setStatusFromHeartbeat({ commit }, status) { | |||
commit('loadStatusFromServer', status) | |||
@@ -289,7 +289,7 @@ const actions = { | |||
/** | |||
* Loads the server from the initial state | |||
* | |||
* @param {Object} vuex The Vuex destructuring object | |||
* @param {object} vuex The Vuex destructuring object | |||
* @param {Function} vuex.commit The Vuex commit function | |||
*/ | |||
loadStatusFromInitialState({ commit }) { |
@@ -253,7 +253,7 @@ export default { | |||
/** | |||
* The message displayed in the top right corner | |||
* | |||
* @returns {String} | |||
* @return {string} | |||
*/ | |||
currentWeatherMessage() { | |||
if (this.loading) { |
@@ -26,11 +26,11 @@ import { generateOcsUrl } from '@nextcloud/router' | |||
/** | |||
* | |||
* | |||
* @param {String} lat the latitude | |||
* @param {String} lon the longitude | |||
* @returns {Promise<Object>} | |||
* @param {string} lat the latitude | |||
* @param {string} lon the longitude | |||
* @return {Promise<object>} | |||
*/ | |||
const setLocation = async(lat, lon) => { | |||
const setLocation = async (lat, lon) => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/location') | |||
const response = await HttpClient.put(url, { | |||
address: '', | |||
@@ -43,10 +43,10 @@ const setLocation = async(lat, lon) => { | |||
/** | |||
* | |||
* @param {String} address The location | |||
* @returns {Promise<Object>} | |||
* @param {string} address The location | |||
* @return {Promise<object>} | |||
*/ | |||
const setAddress = async(address) => { | |||
const setAddress = async (address) => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/location') | |||
const response = await HttpClient.put(url, { | |||
address, | |||
@@ -59,10 +59,10 @@ const setAddress = async(address) => { | |||
/** | |||
* | |||
* @param {String} mode can be 1 browser or 2 custom | |||
* @returns {Promise<Object>} | |||
* @param {string} mode can be 1 browser or 2 custom | |||
* @return {Promise<object>} | |||
*/ | |||
const setMode = async(mode) => { | |||
const setMode = async (mode) => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/mode') | |||
const response = await HttpClient.put(url, { | |||
mode, | |||
@@ -73,9 +73,9 @@ const setMode = async(mode) => { | |||
/** | |||
* | |||
* @returns {Promise<Object>} | |||
* @return {Promise<object>} | |||
*/ | |||
const usePersonalAddress = async() => { | |||
const usePersonalAddress = async () => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/use-personal') | |||
const response = await HttpClient.put(url) | |||
@@ -85,9 +85,9 @@ const usePersonalAddress = async() => { | |||
/** | |||
* Fetches the location information for current user | |||
* | |||
* @returns {Promise<Object>} | |||
* @return {Promise<object>} | |||
*/ | |||
const getLocation = async() => { | |||
const getLocation = async () => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/location') | |||
const response = await HttpClient.get(url) | |||
@@ -97,10 +97,10 @@ const getLocation = async() => { | |||
/** | |||
* Fetches the weather forecast | |||
* | |||
* @param {String} address The location | |||
* @returns {Promise<Object>} | |||
* @param {string} address The location | |||
* @return {Promise<object>} | |||
*/ | |||
const fetchForecast = async() => { | |||
const fetchForecast = async () => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/forecast') | |||
const response = await HttpClient.get(url) | |||
@@ -110,10 +110,10 @@ const fetchForecast = async() => { | |||
/** | |||
* Fetches the location favorites | |||
* | |||
* @param {String} address The location | |||
* @returns {Promise<Object>} | |||
* @param {string} address The location | |||
* @return {Promise<object>} | |||
*/ | |||
const getFavorites = async() => { | |||
const getFavorites = async () => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/favorites') | |||
const response = await HttpClient.get(url) | |||
@@ -123,9 +123,9 @@ const getFavorites = async() => { | |||
/** | |||
* | |||
* @param {Array} favorites List of favorite addresses | |||
* @returns {Promise<Object>} | |||
* @return {Promise<object>} | |||
*/ | |||
const saveFavorites = async(favorites) => { | |||
const saveFavorites = async (favorites) => { | |||
const url = generateOcsUrl('apps/weather_status/api/v1/favorites') | |||
const response = await HttpClient.put(url, { | |||
favorites, |
@@ -159,9 +159,10 @@ const store = new Vuex.Store({ | |||
/** | |||
* Return all available checker plugins for a given entity class | |||
* @param {Object} state the store state | |||
* @param {Object} entity the entity class | |||
* @returns {Array} the available plugins | |||
* | |||
* @param {object} state the store state | |||
* @param {object} entity the entity class | |||
* @return {Array} the available plugins | |||
*/ | |||
getChecksForEntity(state) { | |||
return (entity) => { |
@@ -30,7 +30,7 @@ import ShippedChecks from './components/Checks' | |||
/** | |||
* A plugin for displaying a custom value field for checks | |||
* | |||
* @typedef {Object} CheckPlugin | |||
* @typedef {object} CheckPlugin | |||
* @property {string} class - The PHP class name of the check | |||
* @property {Comparison[]} operators - A list of possible comparison operations running on the check | |||
* @property {Vue} component - A vue component to handle the rendering of options | |||
@@ -39,12 +39,12 @@ import ShippedChecks from './components/Checks' | |||
* event once the data has changed | |||
* @property {callable} placeholder - Return a placeholder of no custom component is used | |||
* @property {callable} validate - validate a check if no custom component is used | |||
**/ | |||
*/ | |||
/** | |||
* A plugin for extending the admin page repesentation of a operator | |||
* | |||
* @typedef {Object} OperatorPlugin | |||
* @typedef {object} OperatorPlugin | |||
* @property {string} id - The PHP class name of the check | |||
* @property {string} operation - Default value for the operation field | |||
* @property {string} color - Custom color code to be applied for the operator selector | |||
@@ -55,10 +55,10 @@ import ShippedChecks from './components/Checks' | |||
*/ | |||
/** | |||
* @typedef {Object} Comparison | |||
* @typedef {object} Comparison | |||
* @property {string} operator - value the comparison should have, e.g. !less, greater | |||
* @property {string} name - Translated readable text, e.g. less or equals | |||
**/ | |||
*/ | |||
/** | |||
* Public javascript api for apps to register custom plugins |
@@ -26,7 +26,7 @@ const isAdmin = !!window._oc_isadmin | |||
/** | |||
* Returns whether the current user is an administrator | |||
* | |||
* @returns {bool} true if the user is an admin, false otherwise | |||
* @return {bool} true if the user is an admin, false otherwise | |||
* @since 9.0.0 | |||
*/ | |||
export const isUserAdmin = () => isAdmin |
@@ -34,7 +34,7 @@ const Apps = { | |||
/** | |||
* Shows the #app-sidebar and add .with-app-sidebar to subsequent siblings | |||
* | |||
* @param {Object} [$el] sidebar element to show, defaults to $('#app-sidebar') | |||
* @param {object} [$el] sidebar element to show, defaults to $('#app-sidebar') | |||
*/ | |||
Apps.showAppSidebar = function($el) { | |||
const $appSidebar = $el || $('#app-sidebar') | |||
@@ -46,7 +46,7 @@ Apps.showAppSidebar = function($el) { | |||
* Shows the #app-sidebar and removes .with-app-sidebar from subsequent | |||
* siblings | |||
* | |||
* @param {Object} [$el] sidebar element to hide, defaults to $('#app-sidebar') | |||
* @param {object} [$el] sidebar element to hide, defaults to $('#app-sidebar') | |||
*/ | |||
Apps.hideAppSidebar = function($el) { | |||
const $appSidebar = $el || $('#app-sidebar') | |||
@@ -81,6 +81,9 @@ export const registerAppsSlideToggle = () => { | |||
const areaSelector = $(button).data('apps-slide-toggle') | |||
const area = $(areaSelector) | |||
/** | |||
* | |||
*/ | |||
function hideArea() { | |||
area.slideUp(OC.menuSpeed * 4, function() { | |||
area.trigger(new $.Event('hide')) | |||
@@ -89,6 +92,9 @@ export const registerAppsSlideToggle = () => { | |||
$(button).removeClass('opened') | |||
} | |||
/** | |||
* | |||
*/ | |||
function showArea() { | |||
area.slideDown(OC.menuSpeed * 4, function() { | |||
area.trigger(new $.Event('show')) |
@@ -27,7 +27,7 @@ import { getCapabilities as realGetCapabilities } from '@nextcloud/capabilities' | |||
/** | |||
* Returns the capabilities | |||
* | |||
* @returns {Array} capabilities | |||
* @return {Array} capabilities | |||
* | |||
* @since 14.0 | |||
*/ |
@@ -36,8 +36,9 @@ export const get = context => name => { | |||
/** | |||
* Set a variable by name | |||
* | |||
* @param {string} context context | |||
* @returns {Function} setter | |||
* @return {Function} setter | |||
* @deprecated 19.0.0 use https://lodash.com/docs#set | |||
*/ | |||
export const set = context => (name, value) => { |
@@ -32,7 +32,7 @@ export const getProtocol = () => window.location.protocol.split(':')[0] | |||
* https://example.com => example.com | |||
* http://example.com:8080 => example.com:8080 | |||
* | |||
* @returns {string} host | |||
* @return {string} host | |||
* | |||
* @since 8.2 | |||
* @deprecated 17.0.0 use window.location.host directly | |||
@@ -43,7 +43,7 @@ export const getHost = () => window.location.host | |||
* Returns the hostname used to access this Nextcloud instance | |||
* The hostname is always stripped of the port | |||
* | |||
* @returns {string} hostname | |||
* @return {string} hostname | |||
* @since 9.0 | |||
* @deprecated 17.0.0 use window.location.hostname directly | |||
*/ | |||
@@ -52,7 +52,7 @@ export const getHostName = () => window.location.hostname | |||
/** | |||
* Returns the port number used to access this Nextcloud instance | |||
* | |||
* @returns {int} port number | |||
* @return {int} port number | |||
* | |||
* @since 8.2 | |||
* @deprecated 17.0.0 use window.location.port directly |
@@ -133,8 +133,9 @@ export default { | |||
*/ | |||
/** | |||
* Check if a user file is allowed to be handled. | |||
* | |||
* @param {string} file to check | |||
* @returns {Boolean} | |||
* @return {boolean} | |||
* @deprecated 17.0.0 | |||
*/ | |||
fileIsBlacklisted: file => !!(file.match(Config.blacklist_files_regex)), | |||
@@ -171,6 +172,7 @@ export default { | |||
/** | |||
* Ajax error handlers | |||
* | |||
* @todo remove from here and keep internally -> requires new tests | |||
*/ | |||
_ajaxConnectionLostHandler: ajaxConnectionLostHandler, | |||
@@ -234,7 +236,7 @@ export default { | |||
/** | |||
* Loads translations for the given app asynchronously. | |||
* | |||
* @param {String} app app name | |||
* @param {string} app app name | |||
* @param {Function} callback callback to call after loading | |||
* @return {Promise} | |||
* @deprecated 17.0.0 use OC.L10N.load instead | |||
@@ -286,9 +288,9 @@ export default { | |||
*/ | |||
linkTo, | |||
/** | |||
* @param {String} service service name | |||
* @param {Number} version OCS API version | |||
* @returns {String} OCS API base path | |||
* @param {string} service service name | |||
* @param {number} version OCS API version | |||
* @return {string} OCS API base path | |||
* @deprecated 19.0.0 use `generateOcsUrl` from https://www.npmjs.com/package/@nextcloud/router | |||
*/ | |||
linkToOCS: (service, version) => { |
@@ -26,8 +26,8 @@ window._oc_l10n_registry_translations = window._oc_l10n_registry_translations || | |||
window._oc_l10n_registry_plural_functions = window._oc_l10n_registry_plural_functions || {} | |||
/** | |||
* @param {String} appId the app id | |||
* @param {Object} translations the translations list | |||
* @param {string} appId the app id | |||
* @param {object} translations the translations list | |||
* @param {Function} pluralFunction the translations list | |||
*/ | |||
const register = (appId, translations, pluralFunction) => { | |||
@@ -36,8 +36,8 @@ const register = (appId, translations, pluralFunction) => { | |||
} | |||
/** | |||
* @param {String} appId the app id | |||
* @param {Object} translations the translations list | |||
* @param {string} appId the app id | |||
* @param {object} translations the translations list | |||
* @param {Function} pluralFunction the translations list | |||
*/ | |||
const extend = (appId, translations, pluralFunction) => { | |||
@@ -49,8 +49,8 @@ const extend = (appId, translations, pluralFunction) => { | |||
} | |||
/** | |||
* @param {String} appId the app id | |||
* @param {Object} translations the translations list | |||
* @param {string} appId the app id | |||
* @param {object} translations the translations list | |||
* @param {Function} pluralFunction the translations list | |||
*/ | |||
export const registerAppTranslations = (appId, translations, pluralFunction) => { | |||
@@ -62,7 +62,7 @@ export const registerAppTranslations = (appId, translations, pluralFunction) => | |||
} | |||
/** | |||
* @param {String} appId the app id | |||
* @param {string} appId the app id | |||
*/ | |||
export const unregisterAppTranslations = appId => { | |||
delete window._oc_l10n_registry_translations[appId] | |||
@@ -70,8 +70,8 @@ export const unregisterAppTranslations = appId => { | |||
} | |||
/** | |||
* @param {String} appId the app id | |||
* @returns {Boolean} | |||
* @param {string} appId the app id | |||
* @return {boolean} | |||
*/ | |||
export const hasAppTranslations = appId => { | |||
return window._oc_l10n_registry_translations[appId] !== undefined | |||
@@ -79,8 +79,8 @@ export const hasAppTranslations = appId => { | |||
} | |||
/** | |||
* @param {String} appId the app id | |||
* @returns {Object} | |||
* @param {string} appId the app id | |||
* @return {object} | |||
*/ | |||
export const getAppTranslations = appId => { | |||
return { |
@@ -1,7 +1,7 @@ | |||
/** | |||
* Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com> | |||
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) | |||
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) | |||
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) | |||
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) | |||
* | |||
* @author Christoph Wurst <christoph@winzerhof-wurst.at> | |||
* @author Daniel Kesselberg <mail@danielkesselberg.de> | |||
@@ -54,10 +54,10 @@ const L10n = { | |||
/** | |||
* Load an app's translation bundle if not loaded already. | |||
* | |||
* @param {String} appName name of the app | |||
* @param {string} appName name of the app | |||
* @param {Function} callback callback to be called when | |||
* the translations are loaded | |||
* @returns {Promise} promise | |||
* @return {Promise} promise | |||
*/ | |||
load(appName, callback) { | |||
// already available ? | |||
@@ -86,28 +86,29 @@ const L10n = { | |||
/** | |||
* Register an app's translation bundle. | |||
* | |||
* @param {String} appName name of the app | |||
* @param {Object<String,String>} bundle bundle | |||
* @param {string} appName name of the app | |||
* @param {object<string, string>} bundle bundle | |||
*/ | |||
register(appName, bundle) { | |||
registerAppTranslations(appName, bundle, this._getPlural) | |||
}, | |||
/** | |||
* @private do not use this | |||
* @private | |||
*/ | |||
_unregister: unregisterAppTranslations, | |||
/** | |||
* Translate a string | |||
* | |||
* @param {string} app the id of the app for which to translate the string | |||
* @param {string} text the string to translate | |||
* @param {Object} [vars] map of placeholder key to value | |||
* @param {object} [vars] map of placeholder key to value | |||
* @param {number} [count] number to replace %n with | |||
* @param {array} [options] options array | |||
* @param {Array} [options] options array | |||
* @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) | |||
* @param {bool} [options.sanitize=true] enable/disable sanitization (by default enabled) | |||
* @returns {string} | |||
* @return {string} | |||
*/ | |||
translate(app, text, vars, count, options) { | |||
const defaultOptions = { | |||
@@ -151,14 +152,15 @@ const L10n = { | |||
/** | |||
* Translate a plural string | |||
* | |||
* @param {string} app the id of the app for which to translate the string | |||
* @param {string} textSingular the string to translate for exactly one object | |||
* @param {string} textPlural the string to translate for n objects | |||
* @param {number} count number to determine whether to use singular or plural | |||
* @param {Object} [vars] map of placeholder key to value | |||
* @param {array} [options] options array | |||
* @param {object} [vars] map of placeholder key to value | |||
* @param {Array} [options] options array | |||
* @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) | |||
* @returns {string} Translated string | |||
* @return {string} Translated string | |||
*/ | |||
translatePlural(app, textSingular, textPlural, count, vars, options) { | |||
const identifier = '_' + textSingular + '_::_' + textPlural + '_' | |||
@@ -183,7 +185,7 @@ const L10n = { | |||
* The plural function taken from symfony | |||
* | |||
* @param {number} number the number of elements | |||
* @returns {number} | |||
* @return {number} | |||
* @private | |||
*/ | |||
_getPlural(number) { | |||
@@ -346,14 +348,14 @@ export default L10n | |||
/** | |||
* Returns the user's locale | |||
* | |||
* @returns {String} locale string | |||
* @return {string} locale string | |||
*/ | |||
export const getLocale = () => $('html').data('locale') ?? 'en' | |||
/** | |||
* Returns the user's language | |||
* | |||
* @returns {String} language string | |||
* @return {string} language string | |||
*/ | |||
export const getLanguage = () => $('html').prop('lang') | |||
@@ -31,10 +31,11 @@ const loadedStyles = [] | |||
/** | |||
* Load a script for the server and load it. If the script is already loaded, | |||
* the event handler will be called directly | |||
* | |||
* @param {string} app the app id to which the script belongs | |||
* @param {string} script the filename of the script | |||
* @param {Function} ready event handler to be called when the script is loaded | |||
* @returns {jQuery.Deferred} | |||
* @return {jQuery.Deferred} | |||
* @deprecated 16.0.0 Use OCP.Loader.loadScript | |||
*/ | |||
export const addScript = (app, script, ready) => { | |||
@@ -56,6 +57,7 @@ export const addScript = (app, script, ready) => { | |||
/** | |||
* Loads a CSS file | |||
* | |||
* @param {string} app the app id to which the css style belongs | |||
* @param {string} style the filename of the css file | |||
* @deprecated 16.0.0 Use OCP.Loader.loadStylesheet |
@@ -35,9 +35,9 @@ export let currentMenuToggle = null | |||
* | |||
* @param {jQuery} $toggle the toggle element | |||
* @param {jQuery} $menuEl the menu container element | |||
* @param {function|undefined} toggle callback invoked everytime the menu is opened | |||
* @param {Function | undefined} toggle callback invoked everytime the menu is opened | |||
* @param {boolean} headerMenu is this a top right header menu? | |||
* @returns {undefined} | |||
* @return {undefined} | |||
*/ | |||
export const registerMenu = function($toggle, $menuEl, toggle, headerMenu) { | |||
$menuEl.addClass('menu') | |||
@@ -119,8 +119,8 @@ export const hideMenus = function(complete) { | |||
/** | |||
* Shows a given element as menu | |||
* | |||
* @param {Object} [$toggle=null] menu toggle | |||
* @param {Object} $menuEl menu element | |||
* @param {object} [$toggle=null] menu toggle | |||
* @param {object} $menuEl menu element | |||
* @param {Function} complete callback when the showing animation is done | |||
*/ | |||
export const showMenu = ($toggle, $menuEl, complete) => { |
@@ -35,7 +35,7 @@ export default { | |||
/** | |||
* Displayes a "Saving..." message in the given message placeholder | |||
* | |||
* @param {Object} selector Placeholder to display the message in | |||
* @param {object} selector Placeholder to display the message in | |||
*/ | |||
startSaving(selector) { | |||
this.startAction(selector, t('core', 'Saving …')) | |||
@@ -44,7 +44,7 @@ export default { | |||
/** | |||
* Displayes a custom message in the given message placeholder | |||
* | |||
* @param {Object} selector Placeholder to display the message in | |||
* @param {object} selector Placeholder to display the message in | |||
* @param {string} message Plain text message to display (no HTML allowed) | |||
*/ | |||
startAction(selector, message) { | |||
@@ -58,9 +58,9 @@ export default { | |||
/** | |||
* Displayes an success/error message in the given selector | |||
* | |||
* @param {Object} selector Placeholder to display the message in | |||
* @param {Object} response Response of the server | |||
* @param {Object} response.data Data of the servers response | |||
* @param {object} selector Placeholder to display the message in | |||
* @param {object} response Response of the server | |||
* @param {object} response.data Data of the servers response | |||
* @param {string} response.data.message Plain text message to display (no HTML allowed) | |||
* @param {string} response.status is being used to decide whether the message | |||
* is displayed as an error/success | |||
@@ -72,9 +72,9 @@ export default { | |||
/** | |||
* Displayes an success/error message in the given selector | |||
* | |||
* @param {Object} selector Placeholder to display the message in | |||
* @param {Object} response Response of the server | |||
* @param {Object} response.data Data of the servers response | |||
* @param {object} selector Placeholder to display the message in | |||
* @param {object} response Response of the server | |||
* @param {object} response.data Data of the servers response | |||
* @param {string} response.data.message Plain text message to display (no HTML allowed) | |||
* @param {string} response.status is being used to decide whether the message | |||
* is displayed as an error/success | |||
@@ -90,7 +90,7 @@ export default { | |||
/** | |||
* Displayes an success message in the given selector | |||
* | |||
* @param {Object} selector Placeholder to display the message in | |||
* @param {object} selector Placeholder to display the message in | |||
* @param {string} message Plain text success message to display (no HTML allowed) | |||
*/ | |||
finishedSuccess(selector, message) { | |||
@@ -106,7 +106,7 @@ export default { | |||
/** | |||
* Displayes an error message in the given selector | |||
* | |||
* @param {Object} selector Placeholder to display the message in | |||
* @param {object} selector Placeholder to display the message in | |||
* @param {string} message Plain text error message to display (no HTML allowed) | |||
*/ | |||
finishedError(selector, message) { |
@@ -25,6 +25,7 @@ export const redirect = targetURL => { window.location = targetURL } | |||
/** | |||
* Reloads the current page | |||
* | |||
* @deprecated 17.0.0 use window.location.reload directly | |||
*/ | |||
export const reload = () => { window.location.reload() } |
@@ -95,10 +95,10 @@ export default { | |||
* Consider using show() instead of showHTML() | |||
* | |||
* @param {string} html Message to display | |||
* @param {Object} [options] options | |||
* @param {object} [options] options | |||
* @param {string} [options.type] notification type | |||
* @param {int} [options.timeout=0] timeout value, defaults to 0 (permanent) | |||
* @returns {jQuery} jQuery element for notification row | |||
* @return {jQuery} jQuery element for notification row | |||
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package | |||
*/ | |||
showHtml(html, options) { | |||
@@ -114,10 +114,10 @@ export default { | |||
* Shows a sanitized notification | |||
* | |||
* @param {string} text Message to display | |||
* @param {Object} [options] options | |||
* @param {object} [options] options | |||
* @param {string} [options.type] notification type | |||
* @param {int} [options.timeout=0] timeout value, defaults to 0 (permanent) | |||
* @returns {jQuery} jQuery element for notification row | |||
* @return {jQuery} jQuery element for notification row | |||
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package | |||
*/ | |||
show(text, options) { | |||
@@ -141,7 +141,7 @@ export default { | |||
* Updates (replaces) a sanitized notification. | |||
* | |||
* @param {string} text Message to display | |||
* @returns {jQuery} JQuery element for notificaiton row | |||
* @return {jQuery} JQuery element for notificaiton row | |||
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package | |||
*/ | |||
showUpdate(text) { | |||
@@ -158,11 +158,11 @@ export default { | |||
* 7 seconds | |||
* | |||
* @param {string} text Message to show | |||
* @param {array} [options] options array | |||
* @param {Array} [options] options array | |||
* @param {int} [options.timeout=7] timeout in seconds, if this is 0 it will show the message permanently | |||
* @param {boolean} [options.isHTML=false] an indicator for HTML notifications (true) or text (false) | |||
* @param {string} [options.type] notification type | |||
* @returns {JQuery<any>} the toast element | |||
* @return {JQuery<any>} the toast element | |||
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package | |||
*/ | |||
showTemporary(text, options) { | |||
@@ -175,7 +175,8 @@ export default { | |||
/** | |||
* Returns whether a notification is hidden. | |||
* @returns {boolean} | |||
* | |||
* @return {boolean} | |||
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package | |||
*/ | |||
isHidden() { |
@@ -52,7 +52,7 @@ export default { | |||
/** | |||
* @param {Function} callback success callback function | |||
* @param {Object} options options | |||
* @param {object} options options | |||
* @param {Function} rejectCallback error callback function | |||
*/ | |||
requirePasswordConfirmation(callback, options, rejectCallback) { |
@@ -31,7 +31,7 @@ export default { | |||
/** | |||
* Register plugin | |||
* | |||
* @param {String} targetName app name / class name to hook into | |||
* @param {string} targetName app name / class name to hook into | |||
* @param {OC.Plugin} plugin plugin | |||
*/ | |||
register(targetName, plugin) { | |||
@@ -46,8 +46,8 @@ export default { | |||
* Returns all plugin registered to the given target | |||
* name / app name / class name. | |||
* | |||
* @param {String} targetName app name / class name to hook into | |||
* @returns {Array.<OC.Plugin>} array of plugins | |||
* @param {string} targetName app name / class name to hook into | |||
* @return {Array.<OC.Plugin>} array of plugins | |||
*/ | |||
getPlugins(targetName) { | |||
return this._plugins[targetName] || [] | |||
@@ -56,9 +56,9 @@ export default { | |||
/** | |||
* Call attach() on all plugins registered to the given target name. | |||
* | |||
* @param {String} targetName app name / class name | |||
* @param {Object} targetObject to be extended | |||
* @param {Object} [options] options | |||
* @param {string} targetName app name / class name | |||
* @param {object} targetObject to be extended | |||
* @param {object} [options] options | |||
*/ | |||
attach(targetName, targetObject, options) { | |||
const plugins = this.getPlugins(targetName) | |||
@@ -72,9 +72,9 @@ export default { | |||
/** | |||
* Call detach() on all plugins registered to the given target name. | |||
* | |||
* @param {String} targetName app name / class name | |||
* @param {Object} targetObject to be extended | |||
* @param {Object} [options] options | |||
* @param {string} targetName app name / class name | |||
* @param {object} targetObject to be extended | |||
* @param {object} [options] options | |||
*/ | |||
detach(targetName, targetObject, options) { | |||
const plugins = this.getPlugins(targetName) |
@@ -26,8 +26,9 @@ import $ from 'jquery' | |||
/** | |||
* Parses a URL query string into a JS map | |||
* | |||
* @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz | |||
* @returns {Object.<string, string>} map containing key/values matching the URL parameters | |||
* @return {object.<string, string>} map containing key/values matching the URL parameters | |||
*/ | |||
export const parse = queryString => { | |||
let pos | |||
@@ -75,8 +76,9 @@ export const parse = queryString => { | |||
/** | |||
* Builds a URL query from a JS map. | |||
* @param {Object.<string, string>} params map containing key/values matching the URL parameters | |||
* @returns {string} String containing a URL query (without question) mark | |||
* | |||
* @param {object.<string, string>} params map containing key/values matching the URL parameters | |||
* @return {string} String containing a URL query (without question) mark | |||
*/ | |||
export const build = params => { | |||
if (!params) { |
@@ -27,7 +27,7 @@ import { emit } from '@nextcloud/event-bus' | |||
* @private | |||
* @param {Document} global the document to read the initial value from | |||
* @param {Function} emit the function to invoke for every new token | |||
* @returns {Object} | |||
* @return {object} | |||
*/ | |||
export const manageToken = (global, emit) => { | |||
let token = global.getElementsByTagName('head')[0].getAttribute('data-requesttoken') | |||
@@ -47,11 +47,11 @@ export const manageToken = (global, emit) => { | |||
const manageFromDocument = manageToken(document, emit) | |||
/** | |||
* @returns {string} | |||
* @return {string} | |||
*/ | |||
export const getToken = manageFromDocument.getToken | |||
/** | |||
* @param {String} newToken new token | |||
* @param {string} newToken new token | |||
*/ | |||
export const setToken = manageFromDocument.setToken |
@@ -28,8 +28,9 @@ import { | |||
/** | |||
* Creates a relative url for remote use | |||
* | |||
* @param {string} service id | |||
* @returns {string} the url | |||
* @return {string} the url | |||
*/ | |||
export const linkToRemoteBase = service => { | |||
return realGetRootUrl() + '/remote.php/' + service |
@@ -41,7 +41,7 @@ export default { | |||
* Note: this includes a workaround for IE8/IE9 that uses | |||
* the hash part instead of the search part. | |||
* | |||
* @param {Object|string} params to append to the URL, can be either a string | |||
* @param {object | string} params to append to the URL, can be either a string | |||
* or a map | |||
* @param {string} [url] URL to be used, otherwise the current URL will be used, | |||
* using the params as query string | |||
@@ -92,7 +92,7 @@ export default { | |||
* Note: this includes a workaround for IE8/IE9 that uses | |||
* the hash part instead of the search part. | |||
* | |||
* @param {Object|string} params to append to the URL, can be either a string or a map | |||
* @param {object | string} params to append to the URL, can be either a string or a map | |||
* @param {string} [url] URL to be used, otherwise the current URL will be used, using the params as query string | |||
*/ | |||
pushState(params, url) { | |||
@@ -105,7 +105,7 @@ export default { | |||
* Note: this includes a workaround for IE8/IE9 that uses | |||
* the hash part instead of the search part. | |||
* | |||
* @param {Object|string} params to append to the URL, can be either a string | |||
* @param {object | string} params to append to the URL, can be either a string | |||
* or a map | |||
* @param {string} [url] URL to be used, otherwise the current URL will be used, | |||
* using the params as query string | |||
@@ -126,7 +126,8 @@ export default { | |||
/** | |||
* Parse a query string from the hash part of the URL. | |||
* (workaround for IE8 / IE9) | |||
* @returns {string} | |||
* | |||
* @return {string} | |||
*/ | |||
_parseHashQuery() { | |||
const hash = window.location.hash | |||
@@ -149,7 +150,7 @@ export default { | |||
* Parse the query/search part of the URL. | |||
* Also try and parse it from the URL hash (for IE8) | |||
* | |||
* @returns {Object} map of parameters | |||
* @return {object} map of parameters | |||
*/ | |||
parseUrlQuery() { | |||
const query = this._parseHashQuery() |
@@ -27,6 +27,9 @@ import History from './util-history' | |||
import OC from './index' | |||
import { formatFileSize as humanFileSize } from '@nextcloud/files' | |||
/** | |||
* @param t | |||
*/ | |||
function chunkify(t) { | |||
// Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288 | |||
const tz = [] | |||
@@ -53,6 +56,7 @@ function chunkify(t) { | |||
/** | |||
* Utility functions | |||
* | |||
* @namespace OC.Util | |||
*/ | |||
export default { | |||
@@ -68,8 +72,9 @@ export default { | |||
* Returns a file size in bytes from a humanly readable string | |||
* Makes 2kB to 2048. | |||
* Inspired by computerFileSize in helper.php | |||
* | |||
* @param {string} string file size in human readable format | |||
* @returns {number} or null if string could not be parsed | |||
* @return {number} or null if string could not be parsed | |||
* | |||
* | |||
*/ | |||
@@ -115,7 +120,7 @@ export default { | |||
/** | |||
* @param {string|number} timestamp timestamp | |||
* @param {string} format date format, see momentjs docs | |||
* @returns {string} timestamp formatted as requested | |||
* @return {string} timestamp formatted as requested | |||
*/ | |||
formatDate(timestamp, format) { | |||
if (window.TESTING === undefined) { | |||
@@ -127,7 +132,7 @@ export default { | |||
/** | |||
* @param {string|number} timestamp timestamp | |||
* @returns {string} human readable difference from now | |||
* @return {string} human readable difference from now | |||
*/ | |||
relativeModifiedDate(timestamp) { | |||
if (window.TESTING === undefined) { | |||
@@ -143,7 +148,7 @@ export default { | |||
/** | |||
* Returns the width of a generic browser scrollbar | |||
* | |||
* @returns {int} width of scrollbar | |||
* @return {int} width of scrollbar | |||
*/ | |||
getScrollBarWidth() { | |||
if (this._scrollBarWidth) { | |||
@@ -183,7 +188,7 @@ export default { | |||
* Remove the time component from a given date | |||
* | |||
* @param {Date} date date | |||
* @returns {Date} date with stripped time | |||
* @return {Date} date with stripped time | |||
*/ | |||
stripTime(date) { | |||
// FIXME: likely to break when crossing DST | |||
@@ -193,9 +198,10 @@ export default { | |||
/** | |||
* Compare two strings to provide a natural sort | |||
* | |||
* @param {string} a first string to compare | |||
* @param {string} b second string to compare | |||
* @returns {number} -1 if b comes before a, 1 if a comes before b | |||
* @return {number} -1 if b comes before a, 1 if a comes before b | |||
* or 0 if the strings are identical | |||
*/ | |||
naturalSortCompare(a, b) { | |||
@@ -222,7 +228,8 @@ export default { | |||
/** | |||
* Calls the callback in a given interval until it returns true | |||
* @param {function} callback function to call on success | |||
* | |||
* @param {Function} callback function to call on success | |||
* @param {integer} interval in milliseconds | |||
*/ | |||
waitFor(callback, interval) { | |||
@@ -237,9 +244,10 @@ export default { | |||
/** | |||
* Checks if a cookie with the given name is present and is set to the provided value. | |||
* | |||
* @param {string} name name of the cookie | |||
* @param {string} value value of the cookie | |||
* @returns {boolean} true if the cookie with the given name has the given value | |||
* @return {boolean} true if the cookie with the given name has the given value | |||
*/ | |||
isCookieSetToValue(name, value) { | |||
const cookies = document.cookie.split(';') |
@@ -41,6 +41,7 @@ export const ajaxConnectionLostHandler = _.throttle(() => { | |||
/** | |||
* Process ajax error, redirects to main page | |||
* if an error/auth error status was returned. | |||
* | |||
* @param {XMLHttpRequest} xhr xhr request | |||
*/ | |||
export const processAjaxError = xhr => { |
@@ -24,6 +24,7 @@ import Search from './search' | |||
/** | |||
* Namespace for apps | |||
* | |||
* @namespace OCA | |||
*/ | |||
export default { |