mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-04 14:27:23 +01:00 
			
		
		
		
	fix: User pills
This commit is contained in:
		
							parent
							
								
									b00111381a
								
							
						
					
					
						commit
						3942de3222
					
				@ -422,6 +422,11 @@ class RoomPillExtension extends HtmlExtension {
 | 
			
		||||
    return userId != null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static final _cachedUsers = <String, User?>{};
 | 
			
		||||
 | 
			
		||||
  Future<User?> _fetchUser(String matrixId) async =>
 | 
			
		||||
      _cachedUsers[room.id + matrixId] ??= await room.requestUser(matrixId);
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  InlineSpan build(
 | 
			
		||||
    ExtensionContext context,
 | 
			
		||||
@ -433,14 +438,18 @@ class RoomPillExtension extends HtmlExtension {
 | 
			
		||||
      return TextSpan(text: context.innerHtml);
 | 
			
		||||
    }
 | 
			
		||||
    if (matrixId.sigil == '@') {
 | 
			
		||||
      final user = room.unsafeGetUserFromMemoryOrFallback(matrixId);
 | 
			
		||||
      return WidgetSpan(
 | 
			
		||||
        child: MatrixPill(
 | 
			
		||||
          key: Key('user_pill_$matrixId'),
 | 
			
		||||
          name: user.calcDisplayname(),
 | 
			
		||||
          avatar: user.avatarUrl,
 | 
			
		||||
          uri: href,
 | 
			
		||||
          outerContext: this.context,
 | 
			
		||||
        child: FutureBuilder<User?>(
 | 
			
		||||
          future: _fetchUser(matrixId),
 | 
			
		||||
          builder: (context, snapshot) => MatrixPill(
 | 
			
		||||
            key: Key('user_pill_$matrixId'),
 | 
			
		||||
            name: _cachedUsers[room.id + matrixId]?.calcDisplayname() ??
 | 
			
		||||
                matrixId.localpart ??
 | 
			
		||||
                matrixId,
 | 
			
		||||
            avatar: _cachedUsers[room.id + matrixId]?.avatarUrl,
 | 
			
		||||
            uri: href,
 | 
			
		||||
            outerContext: this.context,
 | 
			
		||||
          ),
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1059,10 +1059,10 @@ packages:
 | 
			
		||||
    dependency: "direct main"
 | 
			
		||||
    description:
 | 
			
		||||
      name: matrix
 | 
			
		||||
      sha256: "2b07709bce975d2be4dc4cd3cc1196fcd6c0397d4e250b42a498e35523fc28f3"
 | 
			
		||||
      sha256: a1c336a1f1d8f914cd8ec1adb4cab4f062e36ccabcc1a849389c85031a73f9d2
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "0.20.1"
 | 
			
		||||
    version: "0.20.4"
 | 
			
		||||
  matrix_api_lite:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
 | 
			
		||||
@ -62,7 +62,7 @@ dependencies:
 | 
			
		||||
  keyboard_shortcuts: ^0.1.4
 | 
			
		||||
  latlong2: ^0.8.1
 | 
			
		||||
  linkify: ^5.0.0
 | 
			
		||||
  matrix: ^0.20.1
 | 
			
		||||
  matrix: ^0.20.4
 | 
			
		||||
  matrix_homeserver_recommendations: ^0.3.0
 | 
			
		||||
  native_imaging: ^0.1.0
 | 
			
		||||
  package_info_plus: ^4.0.0
 | 
			
		||||
@ -171,4 +171,4 @@ dependency_overrides:
 | 
			
		||||
    git:
 | 
			
		||||
      url: https://github.com/timsneath/wakelock.git
 | 
			
		||||
      ref: 2a9bca63a540771f241d688562351482b2cf234c
 | 
			
		||||
      path: wakelock_windows
 | 
			
		||||
      path: wakelock_windows
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user