fluffychat/lib/pangea/extensions/room_information_extension.dart
ggurdin 89bb560347
4110 playtest 92325 (#4121)
* style activity role tooltip like instruction inline tooltips

* style updates to activity details

* don't show token underlines in practice mode

* show loading activity analytics

* use all construct types to calculate activity analytics, include audio messages in activity summary request

* update chat context menus for activities

* fix positioning on menu in main chat list
2025-09-25 08:46:46 -04:00

45 lines
1.4 KiB
Dart

part of "pangea_room_extension.dart";
extension RoomInformationRoomExtension on Room {
String? get creatorId => getState(EventTypes.RoomCreate)?.senderId;
DateTime? get creationTimestamp {
final creationEvent = getState(EventTypes.RoomCreate) as Event?;
return creationEvent?.originServerTs;
}
bool isFirstOrSecondChild(String roomId) {
return isSpace &&
(spaceChildren.any((room) => room.roomId == roomId) ||
spaceChildren
.where((sc) => sc.roomId != null)
.map((sc) => client.getRoomById(sc.roomId!))
.any(
(room) =>
room != null &&
room.isSpace &&
room.spaceChildren.any((room) => room.roomId == roomId),
));
}
Future<bool> get botIsInRoom async {
final List<User> participants = await requestParticipants();
return participants.any(
(User user) => user.id == BotName.byEnvironment,
);
}
Future<bool> get isBotDM async {
return botOptions?.mode == BotMode.directChat && await botIsInRoom;
}
String? get roomType =>
getState(EventTypes.RoomCreate)?.content.tryGet<String>('type');
bool isAnalyticsRoomOfUser(String userId) =>
isAnalyticsRoom && isMadeByUser(userId);
bool get isAnalyticsRoom => roomType == PangeaRoomTypes.analytics;
bool get isHiddenRoom => isAnalyticsRoom || isHiddenActivityRoom;
}