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

Stop using nullish coalescing operator and optional chaning #3733

Merged
merged 1 commit into from
Jul 7, 2020
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
6 changes: 5 additions & 1 deletion apps/files/src/components/FileDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export default {
},

currentTab() {
return this.currentSidebarTab?.tab || this.defaultTab
if (this.currentSidebarTab && this.currentSidebarTab.tab) {
return this.currentSidebarTab.tab
}

return this.defaultTab
},

activeTabComponent() {
Expand Down
8 changes: 6 additions & 2 deletions apps/files/src/components/FileSharingSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ export default {
...mapState(['user']),

currentPanel() {
const panel = this.currentSidebarTab.options?.collaboratorsCurrentPanel
const tabOptions = this.currentSidebarTab.options

return panel || PANEL_SHOW
if (tabOptions && tabOptions.collaboratorsCurrentPanel) {
return tabOptions.collaboratorsCurrentPanel
LukasHirt marked this conversation as resolved.
Show resolved Hide resolved
}

return PANEL_SHOW
},

$_transitionGroupEnter() {
Expand Down
3 changes: 2 additions & 1 deletion apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export default {

displayOverwriteDialog() {
const translated = this.$gettext('File %{file} already exists')
const isVersioningEnabled = !this.publicPage() && this.capabilities.files?.versioning
const isVersioningEnabled =
!this.publicPage() && this.capabilities.files && this.capabilities.files.versioning
// TODO: Handle properly case of multiple existing files
const title =
this.existingResources.length > 1
Expand Down
22 changes: 11 additions & 11 deletions src/store/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ const actions = {
const mutations = {
CREATE_MODAL(state, modal) {
state.displayed = true
state.variation = modal.variation ?? 'info'
state.variation = modal.variation || 'info'
state.icon = modal.icon
state.title = modal.title
state.message = modal.message
state.cancelText = modal.cancelText ?? 'Cancel'
state.confirmText = modal.confirmText ?? 'Confirm'
state.confirmDisabled = modal.confirmDisabled ?? false
state.cancelText = modal.cancelText || 'Cancel'
state.confirmText = modal.confirmText || 'Confirm'
state.confirmDisabled = modal.confirmDisabled || false
state.onCancel = modal.onCancel
state.onConfirm = modal.onConfirm
state.hasInput = modal.hasInput ?? false
state.inputValue = modal.inputValue ?? null
state.inputPlaceholder = modal.inputPlaceholder ?? null
state.inputLabel = modal.inputLabel ?? null
state.inputError = modal.inputError ?? null
state.inputDisabled = modal.inputDisabled ?? false
state.onInput = modal.onInput ?? emptyReturn
state.hasInput = modal.hasInput || false
state.inputValue = modal.inputValue || null
state.inputPlaceholder = modal.inputPlaceholder || null
state.inputLabel = modal.inputLabel || null
state.inputError = modal.inputError || null
state.inputDisabled = modal.inputDisabled || false
state.onInput = modal.onInput || emptyReturn
},

HIDE_MODAL(state) {
Expand Down