@@ -103,12 +103,17 @@ export const UserIdentityWarning: React.FC<UserIdentityWarningProps> = ({ room }
103103 if ( currentPrompt && membersNeedingApproval . has ( currentPrompt . userId ) ) return currentPrompt ;
104104
105105 if ( membersNeedingApproval . size === 0 ) {
106+ if ( currentPrompt ) {
107+ // If we were previously showing a warning, log that we've stopped doing so.
108+ logger . debug ( "UserIdentityWarning: no users left that need approval" ) ;
109+ }
106110 return undefined ;
107111 }
108112
109113 // We pick the user with the smallest user ID.
110114 const keys = Array . from ( membersNeedingApproval . keys ( ) ) . sort ( ( a , b ) => a . localeCompare ( b ) ) ;
111115 const selection = membersNeedingApproval . get ( keys [ 0 ] ! ) ;
116+ logger . debug ( `UserIdentityWarning: now warning about user ${ selection ?. userId } ` ) ;
112117 return selection ;
113118 } ) ;
114119 } , [ ] ) ;
@@ -132,6 +137,9 @@ export const UserIdentityWarning: React.FC<UserIdentityWarningProps> = ({ room }
132137 // initialising, and we want to start by displaying a warning
133138 // for the user with the smallest ID.
134139 if ( initialisedRef . current === InitialisationStatus . Completed ) {
140+ logger . debug (
141+ `UserIdentityWarning: user ${ userId } now needs approval; approval-pending list now [${ Array . from ( membersNeedingApprovalRef . current . keys ( ) ) } ]` ,
142+ ) ;
135143 updateCurrentPrompt ( ) ;
136144 }
137145 } ,
@@ -173,6 +181,9 @@ export const UserIdentityWarning: React.FC<UserIdentityWarningProps> = ({ room }
173181 const removeMemberNeedingApproval = useCallback (
174182 ( userId : string ) : void => {
175183 membersNeedingApprovalRef . current . delete ( userId ) ;
184+ logger . debug (
185+ `UserIdentityWarning: user ${ userId } no longer needs approval; approval-pending list now [${ Array . from ( membersNeedingApprovalRef . current . keys ( ) ) } ]` ,
186+ ) ;
176187 updateCurrentPrompt ( ) ;
177188 } ,
178189 [ updateCurrentPrompt ] ,
@@ -195,6 +206,9 @@ export const UserIdentityWarning: React.FC<UserIdentityWarningProps> = ({ room }
195206 const members = await room . getEncryptionTargetMembers ( ) ;
196207 await addMembersWhoNeedApproval ( members ) ;
197208
209+ logger . info (
210+ `Initialised UserIdentityWarning component for room ${ room . roomId } with approval-pending list [${ Array . from ( membersNeedingApprovalRef . current . keys ( ) ) } ]` ,
211+ ) ;
198212 updateCurrentPrompt ( ) ;
199213 initialisedRef . current = InitialisationStatus . Completed ;
200214 } , [ crypto , room , addMembersWhoNeedApproval , updateCurrentPrompt ] ) ;
0 commit comments