Fix more issues with the channels panel

* Put the newest notifications at the top
* Have at most 1 notification toast, which is non-interactive,
  but focuses the notification panel on click, and auto-dismisses
  on a timer.
This commit is contained in:
Max Brunsfeld 2023-10-17 15:43:06 -07:00
parent 52834dbf21
commit 660021f5e5
9 changed files with 328 additions and 342 deletions

View file

@ -2331,7 +2331,8 @@ async fn remove_channel_member(
let channel_id = ChannelId::from_proto(request.channel_id);
let member_id = UserId::from_proto(request.user_id);
db.remove_channel_member(channel_id, member_id, session.user_id)
let removed_notification_id = db
.remove_channel_member(channel_id, member_id, session.user_id)
.await?;
let mut update = proto::UpdateChannels::default();
@ -2342,7 +2343,18 @@ async fn remove_channel_member(
.await
.user_connection_ids(member_id)
{
session.peer.send(connection_id, update.clone())?;
session.peer.send(connection_id, update.clone()).trace_err();
if let Some(notification_id) = removed_notification_id {
session
.peer
.send(
connection_id,
proto::DeleteNotification {
notification_id: notification_id.to_proto(),
},
)
.trace_err();
}
}
response.send(proto::Ack {})?;