fix: avatar url

With the recent dicebear update we don't need to use the sync method anymore as toDataUri now is sync.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2024-09-01 10:50:32 +02:00
parent d8281d2d0e
commit 4d7621c45f
4 changed files with 16 additions and 47 deletions

View file

@ -40,8 +40,8 @@
"@codemirror/state": "6.4.1", "@codemirror/state": "6.4.1",
"@codemirror/theme-one-dark": "6.1.2", "@codemirror/theme-one-dark": "6.1.2",
"@codemirror/view": "6.33.0", "@codemirror/view": "6.33.0",
"@dicebear/core": "7.1.3", "@dicebear/core": "9.2.1",
"@dicebear/identicon": "7.1.3", "@dicebear/identicon": "9.2.1",
"@fontsource/source-sans-pro": "5.0.8", "@fontsource/source-sans-pro": "5.0.8",
"@hedgedoc/commons": "workspace:commons", "@hedgedoc/commons": "workspace:commons",
"@hedgedoc/html-to-react": "workspace:html-to-react", "@hedgedoc/html-to-react": "workspace:html-to-react",

View file

@ -23,6 +23,6 @@ export const useAvatarUrl = (photoUrl: string | undefined, displayName: string):
const avatar = createAvatar(identicon, { const avatar = createAvatar(identicon, {
seed: displayName seed: displayName
}) })
return avatar.toDataUriSync() return avatar.toDataUri()
}, [photoUrl, displayName]) }, [photoUrl, displayName])
} }

View file

@ -12,7 +12,7 @@ import { UserAvatar } from './user-avatar'
jest.mock('@dicebear/identicon', () => null) jest.mock('@dicebear/identicon', () => null)
jest.mock('@dicebear/core', () => ({ jest.mock('@dicebear/core', () => ({
createAvatar: jest.fn(() => ({ createAvatar: jest.fn(() => ({
toDataUriSync: jest.fn(() => 'data:image/x-other,identicon-mock') toDataUri: jest.fn(() => 'data:image/x-other,identicon-mock')
})) }))
})) }))

View file

@ -2237,43 +2237,21 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@dicebear/converter@npm:7.1.3": "@dicebear/core@npm:9.2.1":
version: 7.1.3 version: 9.2.1
resolution: "@dicebear/converter@npm:7.1.3" resolution: "@dicebear/core@npm:9.2.1"
dependencies: dependencies:
"@types/json-schema": "npm:^7.0.11" "@types/json-schema": "npm:^7.0.11"
tmp-promise: "npm:^3.0.3" checksum: 10c0/c348adf7156b1d167a936b136eb0e771b4f411e266abb26df535bbb77fc8c46ba20bd1ff50c07dff1b476692be0956c22095481667767aaf5dd2b683afb6ae31
peerDependencies:
"@resvg/resvg-js": ^2.4.1
exiftool-vendored: ^23.0.0
sharp: ^0.32.6
peerDependenciesMeta:
"@resvg/resvg-js":
optional: true
exiftool-vendored:
optional: true
sharp:
optional: true
checksum: 10c0/3693b1643e96916257f3b17e626c565d498a7aca7958b29e904b76323e27b6b97975c564f0ed90b49de6a6b9b88dfcedf5138768abbfbaaf74cbec73db846389
languageName: node languageName: node
linkType: hard linkType: hard
"@dicebear/core@npm:7.1.3": "@dicebear/identicon@npm:9.2.1":
version: 7.1.3 version: 9.2.1
resolution: "@dicebear/core@npm:7.1.3" resolution: "@dicebear/identicon@npm:9.2.1"
dependencies:
"@dicebear/converter": "npm:7.1.3"
"@types/json-schema": "npm:^7.0.11"
checksum: 10c0/3443b8bf95aa12986cd731769d09c3bbf92af811a273719a806471f123ea35b46f07f56ed8dcdb063d917dcbd8d39a19f00f3532ab9792953dbf6109156844e1
languageName: node
linkType: hard
"@dicebear/identicon@npm:7.1.3":
version: 7.1.3
resolution: "@dicebear/identicon@npm:7.1.3"
peerDependencies: peerDependencies:
"@dicebear/core": ^7.0.0 "@dicebear/core": ^9.0.0
checksum: 10c0/178c16338a7c097e50c68ebdf0e280e92004095fcfafb45d43ff9f75b15ec22c67e19c218d060aaf8a7877c13b2c2855034d226d1195d58fa51bd69d7026f487 checksum: 10c0/5e62a1b24d73abec4f58968b5c15ef9303855e916e6fbeecd1d54346cfe154fd846511e801c0c1934e3e6437696497be055081c3ff2d0f326c147218d3fdbe05
languageName: node languageName: node
linkType: hard linkType: hard
@ -2611,8 +2589,8 @@ __metadata:
"@codemirror/state": "npm:6.4.1" "@codemirror/state": "npm:6.4.1"
"@codemirror/theme-one-dark": "npm:6.1.2" "@codemirror/theme-one-dark": "npm:6.1.2"
"@codemirror/view": "npm:6.33.0" "@codemirror/view": "npm:6.33.0"
"@dicebear/core": "npm:7.1.3" "@dicebear/core": "npm:9.2.1"
"@dicebear/identicon": "npm:7.1.3" "@dicebear/identicon": "npm:9.2.1"
"@fontsource/source-sans-pro": "npm:5.0.8" "@fontsource/source-sans-pro": "npm:5.0.8"
"@hedgedoc/commons": "workspace:commons" "@hedgedoc/commons": "workspace:commons"
"@hedgedoc/html-to-react": "workspace:html-to-react" "@hedgedoc/html-to-react": "workspace:html-to-react"
@ -17534,15 +17512,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"tmp-promise@npm:^3.0.3":
version: 3.0.3
resolution: "tmp-promise@npm:3.0.3"
dependencies:
tmp: "npm:^0.2.0"
checksum: 10c0/23b47dcb2e82b14bbd8f61ed7a9d9353cdb6a6f09d7716616cfd27d0087040cd40152965a518e598d7aabe1489b9569bf1eebde0c5fadeaf3ec8098adcebea4e
languageName: node
linkType: hard
"tmp@npm:^0.0.33": "tmp@npm:^0.0.33":
version: 0.0.33 version: 0.0.33
resolution: "tmp@npm:0.0.33" resolution: "tmp@npm:0.0.33"
@ -17552,7 +17521,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"tmp@npm:^0.2.0, tmp@npm:~0.2.1": "tmp@npm:~0.2.1":
version: 0.2.3 version: 0.2.3
resolution: "tmp@npm:0.2.3" resolution: "tmp@npm:0.2.3"
checksum: 10c0/3e809d9c2f46817475b452725c2aaa5d11985cf18d32a7a970ff25b568438e2c076c2e8609224feef3b7923fa9749b74428e3e634f6b8e520c534eef2fd24125 checksum: 10c0/3e809d9c2f46817475b452725c2aaa5d11985cf18d32a7a970ff25b568438e2c076c2e8609224feef3b7923fa9749b74428e3e634f6b8e520c534eef2fd24125