Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

Better error reporting

This commit is contained in:
Henry Hiles 2026-07-14 16:20:21 -04:00
commit 19c9479539
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 32 additions and 26 deletions

View file

@ -11,7 +11,11 @@ abstract class SetStateRequest with _$SetStateRequest {
required String type,
required String stateKey,
required Content content,
@JsonKey(name: "delay_ms") @MSDuration() @Default(null) Duration? delay,
@JsonKey(name: "delay_ms", includeIfNull: false)
@MSDuration()
@Default(null)
Duration? delay,
}) = _SetStateRequest;
factory SetStateRequest.fromJson(Map<String, Object?> json) =>

View file

@ -175,36 +175,17 @@ class RoomChat extends HookConsumerWidget {
},
);
PopupMenuItem buildPinOption(Event event) {
final isPinned = ref
.watch(PinnedEventsController.provider(roomId))
.maybeWhen(
data: (pinnedEvents) =>
pinnedEvents.any((ev) => ev.eventId == event.eventId),
orElse: () => false,
);
return PopupMenuItem(
onTap: () async {
final notifier = ref.read(
PinnedEventsController.provider(roomId).notifier,
);
if (isPinned) {
await notifier.removePin(event);
} else {
await notifier.addPin(event);
}
},
child: ListTile(
leading: Icon(isPinned ? Icons.push_pin_outlined : Icons.push_pin),
title: Text(isPinned ? "Unpin Event" : "Pin Event"),
),
);
}
IList<PopupMenuEntry> getEventOptions(Event event) {
final danger = theme.colorScheme.error;
final isSentByMe = event.sender == userId;
final isPinned = ref
.watch(PinnedEventsController.provider(roomId))
.whenOrNull(
data: (pinnedEvents) =>
pinnedEvents.any((ev) => ev.eventId == event.eventId),
);
return [
if (ref.watch(
PowerLevelController.provider(
@ -282,7 +263,28 @@ class RoomChat extends HookConsumerWidget {
PowerLevelConfig(eventType: .pinnedEvents, roomId: roomId),
),
))
buildPinOption(event),
PopupMenuItem(
onTap: isPinned == null
? null
: () async {
try {
final notifier = ref.read(
PinnedEventsController.provider(roomId).notifier,
);
if (isPinned) {
await notifier.removePin(event);
} else {
await notifier.addPin(event);
}
} catch (error, stackTrace) {
showError(error, stackTrace);
}
},
child: ListTile(
leading: Icon(Icons.push_pin),
title: Text(isPinned == true ? "Unpin Event" : "Pin Event"),
),
),
PopupMenuItem(
onTap: () async {
final room = ref.watch(