/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import type { Node, View } from '@nextcloud/files'
import { emit } from '@nextcloud/event-bus'
import { FileAction, registerFileAction } from '@nextcloud/files'
import { generateOcsUrl } from '@nextcloud/router'
import { translatePlural as n } from '@nextcloud/l10n'
import ArrowULeftTopSvg from '@mdi/svg/svg/arrow-u-left-top.svg?raw'
import axios from '@nextcloud/axios'
import { deletedSharesViewId } from '../files_views/shares'
export const action = new FileAction({
id: 'restore-share',
displayName: (nodes: Node[]) => n('files_sharing', 'Restore share', 'Restore shares', nodes.length),
iconSvgInline: () => ArrowULeftTopSvg,
enabled: (nodes, view) => nodes.length > 0 && view.id === deletedSharesViewId,
async exec(node: Node) {
try {
const url = generateOcsUrl('apps/files_sharing/api/v1/deletedshares/{id}', {
id: node.attributes.id,
})
await axios.post(url)
// Remove from current view
emit('files:node:deleted', node)
return true
} catch (error) {
return false
}
},
async execBatch(nodes: Node[], view: View, dir: string) {
return Promise.all(nodes.map(node => this.exec(node, view, dir)))
},
order: 1,
inline: () => true,
})
registerFileAction(action)
ions-66959c3ab9'>dependabot/github_actions/github-actions-66959c3ab9
dependabot/github_actions/github-actions-6951dec90a
dependabot/github_actions/github-actions-7574396d95
dependabot/github_actions/github-actions-a2938ab9b9
dependabot/github_actions/github-actions-ced721f930
dependabot/github_actions/github-actions-e7ab6fa4fa
dependabot/github_actions/github-actions-f50e11107c
dependabot/npm_and_yarn/body-parser-1.20.3
dependabot/npm_and_yarn/express-4.20.0
interactions
jtr-test
main
spinner-globalize-1.x
The official jQuery user interface library: https://github.com/jquery/jquery-ui www-data
blob: d43e4f816686da222193b201a1cccc72b8dca147 (
plain )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
( function ( factory ) {
if ( typeof define === "function" && define . amd ) {
// AMD. Register as an anonymous module.
define ( [ "jquery" , "./version" ], factory );
} else {
// Browser globals
factory ( jQuery );
}
} ( function ( $ ) {
// Internal use only
return $ . ui . escapeSelector = ( function () {
var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g ;
return function ( selector ) {
return selector . replace ( selectorEscape , "\\$1" );
};
} )();
} ) );