mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-16 08:59:31 +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;
|
return userId != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final _cachedUsers = <String, User?>{};
|
||||||
|
|
||||||
|
Future<User?> _fetchUser(String matrixId) async =>
|
||||||
|
_cachedUsers[room.id + matrixId] ??= await room.requestUser(matrixId);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InlineSpan build(
|
InlineSpan build(
|
||||||
ExtensionContext context,
|
ExtensionContext context,
|
||||||
@ -433,15 +438,19 @@ class RoomPillExtension extends HtmlExtension {
|
|||||||
return TextSpan(text: context.innerHtml);
|
return TextSpan(text: context.innerHtml);
|
||||||
}
|
}
|
||||||
if (matrixId.sigil == '@') {
|
if (matrixId.sigil == '@') {
|
||||||
final user = room.unsafeGetUserFromMemoryOrFallback(matrixId);
|
|
||||||
return WidgetSpan(
|
return WidgetSpan(
|
||||||
child: MatrixPill(
|
child: FutureBuilder<User?>(
|
||||||
|
future: _fetchUser(matrixId),
|
||||||
|
builder: (context, snapshot) => MatrixPill(
|
||||||
key: Key('user_pill_$matrixId'),
|
key: Key('user_pill_$matrixId'),
|
||||||
name: user.calcDisplayname(),
|
name: _cachedUsers[room.id + matrixId]?.calcDisplayname() ??
|
||||||
avatar: user.avatarUrl,
|
matrixId.localpart ??
|
||||||
|
matrixId,
|
||||||
|
avatar: _cachedUsers[room.id + matrixId]?.avatarUrl,
|
||||||
uri: href,
|
uri: href,
|
||||||
outerContext: this.context,
|
outerContext: this.context,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (matrixId.sigil == '#' || matrixId.sigil == '!') {
|
if (matrixId.sigil == '#' || matrixId.sigil == '!') {
|
||||||
|
@ -1059,10 +1059,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: matrix
|
name: matrix
|
||||||
sha256: "2b07709bce975d2be4dc4cd3cc1196fcd6c0397d4e250b42a498e35523fc28f3"
|
sha256: a1c336a1f1d8f914cd8ec1adb4cab4f062e36ccabcc1a849389c85031a73f9d2
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.20.1"
|
version: "0.20.4"
|
||||||
matrix_api_lite:
|
matrix_api_lite:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -62,7 +62,7 @@ dependencies:
|
|||||||
keyboard_shortcuts: ^0.1.4
|
keyboard_shortcuts: ^0.1.4
|
||||||
latlong2: ^0.8.1
|
latlong2: ^0.8.1
|
||||||
linkify: ^5.0.0
|
linkify: ^5.0.0
|
||||||
matrix: ^0.20.1
|
matrix: ^0.20.4
|
||||||
matrix_homeserver_recommendations: ^0.3.0
|
matrix_homeserver_recommendations: ^0.3.0
|
||||||
native_imaging: ^0.1.0
|
native_imaging: ^0.1.0
|
||||||
package_info_plus: ^4.0.0
|
package_info_plus: ^4.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user