add info message when leave group

This commit is contained in:
rick 2022-11-01 20:06:36 +01:00
parent 974c75b9b6
commit f9259d9d10
Signed by: Rick
GPG key ID: 4A6223D66294EB20

View file

@ -281,10 +281,17 @@ impl Component for ListGroups {
true
}
MsgListGroups::FinishLeave(id) => {
self.free_groups.push(self.groups.remove(id));
let group = self.groups.remove(id);
let name = group.name.clone();
self.free_groups.push(group);
if self.nb_show > 0 && id <= self.nb_show {
self.nb_show -= 1;
}
ctx.link().send_message(MsgListGroups::Info(
String::from(&format!("Vous avez bien quitté le groupe {}", name)),
String::new(),
));
true
}
MsgListGroups::SelectGroup(id) => {
@ -322,7 +329,7 @@ impl Component for ListGroups {
}
false
}
MsgListGroups::Refresh => return true,
MsgListGroups::Refresh => true,
MsgListGroups::More => {
self.nb_show += 3;
if self.nb_show > self.groups.len() {