Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable optional chaining on configuration access #6891

Merged
merged 2 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Enable optional chaining on configuration options access

We've optional chaining on configuration options access to prevent unwanted access on
undefined properties which might cause errors.

https://github.com/owncloud/web/pull/6891
2 changes: 1 addition & 1 deletion packages/web-app-files/src/components/Search/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default defineComponent({
...mapGetters(['configuration']),
...mapGetters('Files', ['totalFilesCount', 'totalFilesSize']),
displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/components/Search/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default {
return this.$gettext('Personal')
},
displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},
beforeMount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default {
...mapGetters(['configuration', 'getToken', 'user']),

helpersEnabled() {
return this.configuration.options.contextHelpers
return this.configuration?.options?.contextHelpers
},

inviteCollaboratorHelp() {
Expand Down Expand Up @@ -197,7 +197,7 @@ export default {
query,
'folder',
1,
this.configuration.options.sharingRecipientsPerPage
this.configuration?.options?.sharingRecipientsPerPage
)

const users = recipients.exact.users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export default defineComponent({
},

helpersEnabled() {
return this.configuration.options.contextHelpers
return this.configuration?.options?.contextHelpers
},

viaLinkHelp() {
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/Favorites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default defineComponent({
},

displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},

Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/Personal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default defineComponent({
},

displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},

Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/PublicFiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default defineComponent({
},

displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},

Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-files/src/views/shares/SharedViaLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default defineComponent({
...mapState('Files/sidebar', { sidebarClosed: 'closed' }),

helpersEnabled() {
return this.configuration.options.contextHelpers
return this.configuration?.options?.contextHelpers
},

quickLinkHelp() {
Expand All @@ -116,7 +116,7 @@ export default defineComponent({
},

displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},

Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/shares/SharedWithMe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export default defineComponent({
}
},
displayThumbnails() {
return !this.configuration.options.disablePreviews && this.viewMode === ShareStatus.accepted
return !this.configuration?.options?.disablePreviews && this.viewMode === ShareStatus.accepted
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default defineComponent({
},

displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},

Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/spaces/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default defineComponent({
: this.$gettext('Show less')
},
displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
},
memberCount() {
return this.space.spaceMemberIds.length
Expand Down
4 changes: 2 additions & 2 deletions packages/web-runtime/src/components/Topbar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ export default {
},

isFeedbackLinkEnabled() {
return !this.configuration.options.disableFeedbackLink
return !this.configuration?.options?.disableFeedbackLink
},

feedbackLinkOptions() {
const feedback = this.configuration.options.feedbackLink
const feedback = this.configuration?.options?.feedbackLink
if (!this.isFeedbackLinkEnabled || !feedback) {
return {}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web-runtime/src/components/UploadInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default {
)
},
displayThumbnails() {
return !this.configuration.options.disablePreviews
return !this.configuration?.options?.disablePreviews
}
},
mounted() {
Expand Down