fix: show bot avatar in open roles indicator (#3966)

This commit is contained in:
ggurdin 2025-09-12 12:20:34 -04:00 committed by GitHub
parent ee20bc6469
commit 3b3e1bfe4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View file

@ -43,7 +43,6 @@ import '../../widgets/matrix.dart';
import 'package:fluffychat/utils/tor_stub.dart'
if (dart.library.html) 'package:tor_detector_web/tor_detector_web.dart';
enum PopupMenuAction {
settings,
invite,

View file

@ -70,6 +70,7 @@ class ChatListItemSubtitle extends StatelessWidget {
userIds:
room.activityRoles?.roles.values.map((r) => r.userId).toList() ??
[],
room: room,
space: room.courseParent,
);
} else if (room.activityIsFinished) {

View file

@ -10,12 +10,14 @@ import 'package:fluffychat/widgets/avatar.dart';
class OpenRolesIndicator extends StatelessWidget {
final int totalSlots;
final List<String> userIds;
final Room? room;
final Room? space;
const OpenRolesIndicator({
super.key,
required this.totalSlots,
required this.userIds,
this.room,
this.space,
});
@ -26,19 +28,21 @@ class OpenRolesIndicator extends StatelessWidget {
totalSlots - userIds.length,
);
final roomParticipants = room?.getParticipants() ?? [];
final spaceParticipants = space?.getParticipants() ?? [];
return Row(
spacing: 2.0,
children: [
...userIds.map((u) {
final user = spaceParticipants.firstWhereOrNull(
(p) => p.id == u,
);
final user = roomParticipants.firstWhereOrNull((p) => p.id == u) ??
spaceParticipants.firstWhereOrNull((p) => p.id == u);
return Avatar(
mxContent: user?.avatarUrl,
userId: user?.calcDisplayname() ?? u.localpart ?? u,
name: user?.calcDisplayname() ?? u.localpart ?? u,
size: 16,
userId: u,
);
}),
...List.generate(remainingSlots, (_) {