Skip to content

Commit

Permalink
Merge pull request #40993 from nextcloud/pulsejet/oc-cap-refactor
Browse files Browse the repository at this point in the history
refactor: remove remaining usage of OC::getCapabilities
  • Loading branch information
susnux authored Oct 20, 2023
2 parents 14bc7d3 + 77cce71 commit df74fb0
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 21 deletions.
7 changes: 4 additions & 3 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<script>
import { generateOcsUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { getCapabilities } from '@nextcloud/capabilities'
import axios from '@nextcloud/axios'
import debounce from 'debounce'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
Expand Down Expand Up @@ -175,7 +176,7 @@ export default {
async getSuggestions(search, lookup = false) {
this.loading = true

if (OC.getCapabilities().files_sharing.sharee.query_lookup_default === true) {
if (getCapabilities().files_sharing.sharee.query_lookup_default === true) {
lookup = true
}

Expand All @@ -191,7 +192,7 @@ export default {
this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH,
]

if (OC.getCapabilities().files_sharing.public.enabled === true) {
if (getCapabilities().files_sharing.public.enabled === true) {
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
}

Expand Down Expand Up @@ -499,7 +500,7 @@ export default {
shareType: value.shareType,
shareWith: value.shareWith,
password,
permissions: this.fileInfo.sharePermissions & OC.getCapabilities().files_sharing.default_permissions,
permissions: this.fileInfo.sharePermissions & getCapabilities().files_sharing.default_permissions,
attributes: JSON.stringify(this.fileInfo.shareAttributes),
})

Expand Down
9 changes: 5 additions & 4 deletions apps/files_sharing/src/services/ConfigService.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

import { loadState } from '@nextcloud/initial-state'
import { getCapabilities } from '@nextcloud/capabilities'

export default class Config {

Expand Down Expand Up @@ -213,7 +214,7 @@ export default class Config {
* @memberof Config
*/
get isMailShareAllowed() {
const capabilities = OC.getCapabilities()
const capabilities = getCapabilities()
// eslint-disable-next-line camelcase
return capabilities?.files_sharing?.sharebymail !== undefined
// eslint-disable-next-line camelcase
Expand Down Expand Up @@ -272,7 +273,7 @@ export default class Config {
* @memberof Config
*/
get isPasswordForMailSharesRequired() {
return (OC.getCapabilities().files_sharing.sharebymail === undefined) ? false : OC.getCapabilities().files_sharing.sharebymail.password.enforced
return (getCapabilities().files_sharing.sharebymail === undefined) ? false : getCapabilities().files_sharing.sharebymail.password.enforced
}

/**
Expand All @@ -281,7 +282,7 @@ export default class Config {
* @memberof Config
*/
get shouldAlwaysShowUnique() {
return (OC.getCapabilities().files_sharing?.sharee?.always_show_unique === true)
return (getCapabilities().files_sharing?.sharee?.always_show_unique === true)
}

/**
Expand Down Expand Up @@ -326,7 +327,7 @@ export default class Config {
* @memberof Config
*/
get passwordPolicy() {
const capabilities = OC.getCapabilities()
const capabilities = getCapabilities()
return capabilities.password_policy ? capabilities.password_policy : {}
}

Expand Down
4 changes: 3 additions & 1 deletion apps/files_sharing/src/views/SharingLinkList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
</template>

<script>
import { getCapabilities } from '@nextcloud/capabilities'

// eslint-disable-next-line no-unused-vars
import Share from '../models/Share.js'
import ShareTypes from '../mixins/ShareTypes.js'
Expand Down Expand Up @@ -80,7 +82,7 @@ export default {

data() {
return {
canLinkShare: OC.getCapabilities().files_sharing.public.enabled,
canLinkShare: getCapabilities().files_sharing.public.enabled,
}
},

Expand Down
7 changes: 4 additions & 3 deletions apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import api from './api.js'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { getCapabilities } from '@nextcloud/capabilities'
import logger from '../logger.js'

const orderGroups = function(groups, orderBy) {
Expand Down Expand Up @@ -428,9 +429,9 @@ const actions = {
},

getPasswordPolicyMinLength(context) {
if (OC.getCapabilities().password_policy && OC.getCapabilities().password_policy.minLength) {
context.commit('setPasswordPolicyMinLength', OC.getCapabilities().password_policy.minLength)
return OC.getCapabilities().password_policy.minLength
if (getCapabilities().password_policy && getCapabilities().password_policy.minLength) {
context.commit('setPasswordPolicyMinLength', getCapabilities().password_policy.minLength)
return getCapabilities().password_policy.minLength
}
return false
},
Expand Down
3 changes: 0 additions & 3 deletions dist/731-731.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/731-731.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions dist/9923-9923.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/9923-9923.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

0 comments on commit df74fb0

Please sign in to comment.