File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3+ * SPDX-License-Identifier: GPL-3.0-or-later
4+ */
5+ import { NextcloudUser } from './user'
6+
7+ declare module '@nextcloud/event-bus' {
8+ export interface NextcloudEvents {
9+ // mapping of 'event name' => 'event type'
10+ 'user:info:changed' : NextcloudUser
11+ }
12+ }
Original file line number Diff line number Diff line change 44 */
55import { getBuilder } from '@nextcloud/browser-storage'
66import { NextcloudUser } from './user'
7- import { emit } from '@nextcloud/event-bus'
7+ import { emit , subscribe } from '@nextcloud/event-bus'
88
99const browserStorage = getBuilder ( 'public' ) . persist ( ) . build ( )
1010
@@ -23,6 +23,11 @@ class GuestUser implements NextcloudUser {
2323 this . uid = browserStorage . getItem ( 'guestUid' ) || self . crypto . randomUUID ( )
2424 this . isAdmin = false
2525
26+ subscribe ( 'user:info:changed' , ( guest ) => {
27+ this . _displayName = guest . displayName
28+ browserStorage . setItem ( 'guestNickname' , guest . displayName || '' )
29+ } )
30+
2631 }
2732
2833 get displayName ( ) : string | null {
You can’t perform that action at this time.
0 commit comments