fix: show bot avatar in open roles indicator (#3966)
This commit is contained in:
parent
ee20bc6469
commit
3b3e1bfe4e
3 changed files with 9 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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, (_) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue