Skip to content
Closed
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
37 changes: 36 additions & 1 deletion apps/files/src/components/FileEntry/FileEntryName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ export default Vue.extend({
}
},

data() {
return {
isConfirmationFileCanHidden: false,
}
},

computed: {
isRenaming() {
return this.renamingStore.renamingNode === this.source
Expand Down Expand Up @@ -261,7 +267,7 @@ export default Vue.extend({
})
},
stopRenaming() {
if (!this.isRenaming) {
if (!this.isRenaming || this.isConfirmationFileCanHidden) {
return
}

Expand Down Expand Up @@ -290,6 +296,35 @@ export default Vue.extend({
return
}

// Checking and displaying confirmation that a file can be hidden
if(/^\.{1,}.+$/.test(newName)){
const confirm = await new Promise<boolean>(resolve => {
this.isConfirmationFileCanHidden = true

OC.dialogs.confirmDestructive(
t('files', 'Are you sure you want to rename the file from {oldName} to {newName}? The file can be hidden.', { oldName, newName }),
t('files', 'Confirm renaming'),
{
type: OC.dialogs.YES_NO_BUTTONS,
confirm: 'Yes',
confirmClasses: 'error',
cancel: t('files', 'Cancel'),
},
(decision: boolean) => {
resolve(decision)
},
)
return
})

// If the user cancels, we don't continue and return focus to the file
if (confirm === false) {
return
}

this.isConfirmationFileCanHidden = false
}

// Set loading state
this.loading = 'renaming'
Vue.set(this.source, 'status', NodeStatus.LOADING)
Expand Down