mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 18:55:19 -04:00
feat(frontend): deactivate alias buttons if user is not owner
These buttons and their functionality only work if the user is the owner, so it doesn't make sense to make it possible to press them otherwise… Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
107ec7a522
commit
09e56a418e
5 changed files with 122 additions and 5 deletions
23
frontend/src/test-utils/note-ownership.ts
Normal file
23
frontend/src/test-utils/note-ownership.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import * as useApplicationStateModule from '../hooks/common/use-application-state'
|
||||
import type { ApplicationState } from '../redux/application-state'
|
||||
|
||||
jest.mock('../hooks/common/use-application-state')
|
||||
export const mockNoteOwnership = (ownUsername: string, noteOwner: string) => {
|
||||
jest.spyOn(useApplicationStateModule, 'useApplicationState').mockImplementation((fn) => {
|
||||
return fn({
|
||||
noteDetails: {
|
||||
permissions: {
|
||||
owner: noteOwner
|
||||
}
|
||||
},
|
||||
user: {
|
||||
username: ownUsername
|
||||
}
|
||||
} as ApplicationState)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue