mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 18:56:32 -05:00
fix(deletion-modal): include note title fallback
The note deletion modal previously only used the set title of the note. This commit changes the dialog to use the result of useNoteTitle() which contains a fallback string. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
2276b4205d
commit
aacdc2a046
3 changed files with 6 additions and 6 deletions
|
@ -16,7 +16,7 @@ describe('Delete note', () => {
|
|||
})
|
||||
cy.getByCypressId('sidebar.deleteNote.button').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', '')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', 'Untitled')
|
||||
cy.getByCypressId('deletionModal.confirmButton').should('be.visible').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('not.be.exist')
|
||||
cy.getByCypressId('notification-toast').should('not.exist')
|
||||
|
@ -28,7 +28,7 @@ describe('Delete note', () => {
|
|||
})
|
||||
cy.getByCypressId('sidebar.deleteNote.button').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', '')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', 'Untitled')
|
||||
cy.getByCypressId('deletionModal.confirmButton').should('be.visible').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('not.exist')
|
||||
cy.getByCypressId('notification-toast').should('be.visible')
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { useNoteTitle } from '../../../../../hooks/common/use-note-title'
|
||||
import { Logger } from '../../../../../utils/logger'
|
||||
import { useUiNotifications } from '../../../../notifications/ui-notification-boundary'
|
||||
import type { MessageTransporter } from '@hedgedoc/commons'
|
||||
|
@ -21,7 +21,7 @@ const logger = new Logger('UseOnNoteDeleted')
|
|||
*/
|
||||
export const useOnNoteDeleted = (websocketConnection: MessageTransporter): void => {
|
||||
const router = useRouter()
|
||||
const noteTitle = useApplicationState((state) => state.noteDetails.title)
|
||||
const noteTitle = useNoteTitle()
|
||||
const { dispatchUiNotification } = useUiNotifications()
|
||||
|
||||
const noteDeletedHandler = useCallback(() => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { useNoteTitle } from '../../../../../hooks/common/use-note-title'
|
||||
import { cypressId } from '../../../../../utils/cypress-attribute'
|
||||
import type { ModalVisibilityProps } from '../../../../common/modals/common-modal'
|
||||
import { DeletionModal } from '../../../../common/modals/deletion-modal'
|
||||
|
@ -44,7 +44,7 @@ export const DeleteNoteModal: React.FC<DeleteNoteModalProps & DeleteHistoryNoteM
|
|||
modalWarningI18nKey,
|
||||
modalButtonI18nKey
|
||||
}) => {
|
||||
const noteTitle = useApplicationState((state) => state.noteDetails.title)
|
||||
const noteTitle = useNoteTitle()
|
||||
|
||||
return (
|
||||
<DeletionModal
|
||||
|
|
Loading…
Reference in a new issue