aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2024-01-31 20:38:34 +0100
committerfenn-cs <fenn25.fn@gmail.com>2024-02-03 20:31:03 +0100
commitd36c002305b9584cbbf8b20b6f0aa3b56f8db3d7 (patch)
tree98bbcc93f18be1bd7513f90161fc2d09a306c86a /apps
parent61adb716fe1efbb2fab113791b58787390902a8b (diff)
downloadnextcloud-server-d36c002305b9584cbbf8b20b6f0aa3b56f8db3d7.tar.gz
nextcloud-server-d36c002305b9584cbbf8b20b6f0aa3b56f8db3d7.zip
Use `@nextcloud/capabilities` to obtain share api defaults
- Remove redundant initial state added - Call `getCapabilities()` in share config file. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Listener/LoadSidebarListener.php7
-rw-r--r--apps/files_sharing/src/services/ConfigService.js20
2 files changed, 8 insertions, 19 deletions
diff --git a/apps/files_sharing/lib/Listener/LoadSidebarListener.php b/apps/files_sharing/lib/Listener/LoadSidebarListener.php
index c271d1db71f..7a36551358e 100644
--- a/apps/files_sharing/lib/Listener/LoadSidebarListener.php
+++ b/apps/files_sharing/lib/Listener/LoadSidebarListener.php
@@ -48,12 +48,5 @@ class LoadSidebarListener implements IEventListener {
}
Util::addScript(Application::APP_ID, 'files_sharing_tab', 'files');
-
- $shareConfig = [
- 'allowPublicUploads' => $this->shareManager->shareApiLinkAllowPublicUpload(),
- 'defaultPermissions' => $this->shareManager->shareApiDefaultPermissions(),
- ];
-
- $this->initialState->provideInitialState('shareConfig', $shareConfig);
}
}
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js
index 8afa41e80e5..59e84b707c1 100644
--- a/apps/files_sharing/src/services/ConfigService.js
+++ b/apps/files_sharing/src/services/ConfigService.js
@@ -21,14 +21,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
-import { loadState } from '@nextcloud/initial-state'
import { getCapabilities } from '@nextcloud/capabilities'
export default class Config {
constructor() {
- this._shareConfig = loadState('files_sharing', 'shareConfig', {})
+ this._capabilities = getCapabilities()
}
/**
@@ -39,7 +37,7 @@ export default class Config {
* @memberof Config
*/
get defaultPermissions() {
- return this._shareConfig.defaultPermissions
+ return this._capabilities.files_sharing?.default_permissions
}
/**
@@ -50,7 +48,7 @@ export default class Config {
* @memberof Config
*/
get isPublicUploadEnabled() {
- return this._shareConfig.allowPublicUploads
+ return this._capabilities.files_sharing?.public.upload
}
/**
@@ -225,11 +223,10 @@ export default class Config {
* @memberof Config
*/
get isMailShareAllowed() {
- const capabilities = getCapabilities()
// eslint-disable-next-line camelcase
- return capabilities?.files_sharing?.sharebymail !== undefined
+ return this._capabilities?.files_sharing?.sharebymail !== undefined
// eslint-disable-next-line camelcase
- && capabilities?.files_sharing?.public?.enabled === true
+ && this._capabilities?.files_sharing?.public?.enabled === true
}
/**
@@ -284,7 +281,7 @@ export default class Config {
* @memberof Config
*/
get isPasswordForMailSharesRequired() {
- return (getCapabilities().files_sharing.sharebymail === undefined) ? false : getCapabilities().files_sharing.sharebymail.password.enforced
+ return (this._capabilities.files_sharing.sharebymail === undefined) ? false : this._capabilities.files_sharing.sharebymail.password.enforced
}
/**
@@ -293,7 +290,7 @@ export default class Config {
* @memberof Config
*/
get shouldAlwaysShowUnique() {
- return (getCapabilities().files_sharing?.sharee?.always_show_unique === true)
+ return (this._capabilities.files_sharing?.sharee?.always_show_unique === true)
}
/**
@@ -338,8 +335,7 @@ export default class Config {
* @memberof Config
*/
get passwordPolicy() {
- const capabilities = getCapabilities()
- return capabilities.password_policy ? capabilities.password_policy : {}
+ return this._capabilities.password_policy ? this._capabilities.password_policy : {}
}
}