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