Skip to content

Commit

Permalink
Enable optional chaining on configuration access (#6891)
Browse files Browse the repository at this point in the history
* Enable optional chaining on configuration access

* Add changelog item
  • Loading branch information
Jan authored May 6, 2022
1 parent 92f5fc3 commit ddb1880
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 16 deletions.
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

0 comments on commit ddb1880

Please sign in to comment.