File tree 2 files changed +18
-1
lines changed
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 4
4
*/
5
5
import { getBuilder } from '@nextcloud/browser-storage'
6
6
import { NextcloudUser } from './user'
7
- import { emit } from '@nextcloud/event-bus'
7
+ import { emit , subscribe } from '@nextcloud/event-bus'
8
8
9
9
const browserStorage = getBuilder ( 'public' ) . persist ( ) . build ( )
10
10
@@ -23,6 +23,11 @@ class GuestUser implements NextcloudUser {
23
23
this . uid = browserStorage . getItem ( 'guestUid' ) || self . crypto . randomUUID ( )
24
24
this . isAdmin = false
25
25
26
+ subscribe ( 'user:info:changed' , ( guest ) => {
27
+ this . _displayName = guest . displayName
28
+ browserStorage . setItem ( 'guestNickname' , guest . displayName || '' )
29
+ } )
30
+
26
31
}
27
32
28
33
get displayName ( ) : string | null {
You can’t perform that action at this time.
0 commit comments