Skip to content

Commit

Permalink
feature(files) : When creating a new folder give a hint that folder n…
Browse files Browse the repository at this point in the history
…ames starting with dots might be hidden #21609

Signed-off-by: Andrii Rublov <airublev@outlook.com>
  • Loading branch information
Andrii Rublov authored and arublov committed Feb 19, 2024
1 parent 1bc8129 commit 43212e8
Showing 1 changed file with 36 additions and 1 deletion.
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

0 comments on commit 43212e8

Please sign in to comment.