diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2024-01-31 20:38:34 +0100 |
---|---|---|
committer | fenn-cs <fenn25.fn@gmail.com> | 2024-02-01 17:53:36 +0100 |
commit | d1ec85d1c7810610610252ed5b0d9cb3bba2d60d (patch) | |
tree | 3b476c73fd6610a081fcbbcafcce274ce68b679b /apps | |
parent | d9a2a7839224505195e65c05b794c523d9384c7a (diff) | |
download | nextcloud-server-d1ec85d1c7810610610252ed5b0d9cb3bba2d60d.tar.gz nextcloud-server-d1ec85d1c7810610610252ed5b0d9cb3bba2d60d.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.php | 7 | ||||
-rw-r--r-- | apps/files_sharing/src/services/ConfigService.js | 20 |
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 7787a348d3a..f82f60a170d 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 : {} } } |