Skip to content

Commit

Permalink
Stop using nullish coalescing operators and optional chanining
Browse files Browse the repository at this point in the history
Using Nullish coalescing operator and optional chaining resulted in syntax errors in translations sync.
  • Loading branch information
LukasHirt committed Jul 6, 2020
1 parent b990689 commit ffa8b12
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
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.currentTab) {
return this.currentTab.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) {
return tabOptions.collaboratorsCurrentPanel
}
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

0 comments on commit ffa8b12

Please sign in to comment.