Merge pull request #54260 from nextcloud/fix/less-useless-toasts

fix: Remove redundant toast notifications
This commit is contained in:
Josh 2025-08-07 17:08:07 -04:00 committed by GitHub
commit 2a96042db1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 18 additions and 36 deletions

View file

@ -2,10 +2,8 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { showInfo } from '@nextcloud/dialogs'
import { Permission, Node, View, FileAction } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import PQueue from 'p-queue'
import CloseSvg from '@mdi/svg/svg/close.svg?raw'
@ -64,7 +62,6 @@ export const action = new FileAction({
// If the user cancels the deletion, we don't want to do anything
if (confirm === false) {
showInfo(t('files', 'Deletion cancelled'))
return null
}
@ -88,7 +85,6 @@ export const action = new FileAction({
// If the user cancels the deletion, we don't want to do anything
if (confirm === false) {
showInfo(t('files', 'Deletion cancelled'))
return Promise.all(nodes.map(() => null))
}

View file

@ -158,7 +158,6 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
}
} catch (error) {
// User cancelled
showError(t('files', 'Move cancelled'))
return
}
}
@ -330,7 +329,6 @@ export const action = new FileAction({
return false
}
if (result === false) {
showInfo(t('files', 'Cancelled move or copy of "{filename}".', { filename: node.displayname }))
return null
}
@ -352,10 +350,6 @@ export const action = new FileAction({
const result = await openFilePickerForAction(action, dir, nodes)
// Handle cancellation silently
if (result === false) {
showInfo(nodes.length === 1
? t('files', 'Cancelled move or copy of "{filename}".', { filename: nodes[0].displayname })
: t('files', 'Cancelled move or copy operation'),
)
return nodes.map(() => null)
}

View file

@ -8,7 +8,7 @@ import { basename } from 'path'
import { emit } from '@nextcloud/event-bus'
import { getCurrentUser } from '@nextcloud/auth'
import { Permission, Folder } from '@nextcloud/files'
import { showError, showInfo, showSuccess } from '@nextcloud/dialogs'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import axios from '@nextcloud/axios'
@ -51,7 +51,6 @@ export const entry = {
async handler(context: Folder, content: Node[]) {
const name = await newNodeName(t('files', 'New folder'), content)
if (name === null) {
showInfo(t('files', 'New folder creation cancelled'))
return
}
try {

View file

@ -115,17 +115,14 @@ describe('files_trashbin: file list actions - empty trashbin', () => {
it('can cancel the deletion by closing the dialog', async () => {
const apiSpy = vi.spyOn(api, 'emptyTrash')
const dialogSpy = vi.spyOn(ncDialogs, 'showInfo')
dialogBuilder.build.mockImplementationOnce(() => ({ show: async () => false }))
expect(await emptyTrashAction.exec(trashbinView, nodes, root)).toBe(null)
expect(apiSpy).not.toBeCalled()
expect(dialogSpy).toBeCalledWith('Deletion cancelled')
})
it('can cancel the deletion', async () => {
const apiSpy = vi.spyOn(api, 'emptyTrash')
const dialogSpy = vi.spyOn(ncDialogs, 'showInfo')
dialogBuilder.build.mockImplementationOnce(() => ({
show: async () => {
@ -136,7 +133,6 @@ describe('files_trashbin: file list actions - empty trashbin', () => {
}))
expect(await emptyTrashAction.exec(trashbinView, nodes, root)).toBe(null)
expect(apiSpy).not.toBeCalled()
expect(dialogSpy).toBeCalledWith('Deletion cancelled')
})
it('will trigger the API request if confirmed', async () => {

View file

@ -11,7 +11,6 @@ import { t } from '@nextcloud/l10n'
import {
DialogSeverity,
getDialogBuilder,
showInfo,
} from '@nextcloud/dialogs'
import { emptyTrash } from '../services/api.ts'
import { TRASHBIN_VIEW_ID } from '../files_views/trashbinView.ts'
@ -71,7 +70,6 @@ export const emptyTrashAction = new FileListAction({
return null
}
showInfo(t('files_trashbin', 'Deletion cancelled'))
return null
},
})

View file

@ -137,7 +137,7 @@ import { emit } from '@nextcloud/event-bus'
import { getCurrentUser } from '@nextcloud/auth'
import { getLanguage, n, t } from '@nextcloud/l10n'
import { loadState } from '@nextcloud/initial-state'
import { showError, showInfo } from '@nextcloud/dialogs'
import { showError } from '@nextcloud/dialogs'
import debounce from 'debounce'
import domPurify from 'dompurify'
import escapeHTML from 'escape-html'
@ -553,7 +553,6 @@ export default defineComponent({
onCancel() {
this.opened = false
showInfo(t('systemtags', 'File tags modification canceled'))
this.$emit('close', null)
},

2
dist/3596-3596.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/3596-3596.js.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/3596-3596.js.map.license vendored Symbolic link
View file

@ -0,0 +1 @@
3596-3596.js.license

2
dist/9498-9498.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
9498-9498.js.license

4
dist/files-init.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long