From e0758047829e0a27cb0786add4d6d2e44990077c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 4 Mar 2025 23:39:55 +0800 Subject: [PATCH] :bug: Bug fixes on channel member cache --- lib/screens/chat/channel_detail.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/screens/chat/channel_detail.dart b/lib/screens/chat/channel_detail.dart index 40cea51..1d86144 100644 --- a/lib/screens/chat/channel_detail.dart +++ b/lib/screens/chat/channel_detail.dart @@ -59,6 +59,7 @@ class _ChannelDetailScreenState extends State { try { final ct = context.read(); final resp = await ct.getChannelProfile(_channel!); + _profile = resp; _notifyLevel = resp.notify; if (!mounted) return; final ud = context.read(); @@ -132,10 +133,11 @@ class _ChannelDetailScreenState extends State { try { final ct = context.read(); final sn = context.read(); - await sn.client.put( + final resp = await sn.client.put( '/cgi/im/channels/${_channel!.keyPath}/members/me/notify', data: {'notify_level': value}, ); + _profile = SnChannelMember.fromJson(resp.data); _notifyLevel = value; await ct.updateChannelProfile(_profile!); if (!mounted) return; @@ -409,11 +411,14 @@ class _ChannelProfileDetailDialogState setState(() => _isBusy = true); try { + final ct = context.read(); final sn = context.read(); - await sn.client.put( + final resp = await sn.client.put( '/cgi/im/channels/${widget.channel.keyPath}/members/me', data: {'nick': _nickController.text}, ); + final out = SnChannelMember.fromJson(resp.data); + await ct.updateChannelProfile(out); if (!mounted) return; Navigator.pop(context, true); } catch (err) {