Mark group as active when the user hasn't left it

Fixes #269
This commit is contained in:
AsamK 2020-03-22 18:20:52 +01:00
parent 67f6378f7f
commit bb06ae9d9a
3 changed files with 15 additions and 9 deletions

View file

@ -12,13 +12,13 @@ import java.util.List;
public class ListGroupsCommand implements LocalCommand {
private static void printGroup(GroupInfo group, boolean detailed) {
private static void printGroup(GroupInfo group, boolean detailed, String username) {
if (detailed) {
System.out.println(String.format("Id: %s Name: %s Active: %s Blocked: %b Members: %s",
Base64.encodeBytes(group.groupId), group.name, group.active, group.blocked, group.members));
Base64.encodeBytes(group.groupId), group.name, group.members.contains(username), group.blocked, group.members));
} else {
System.out.println(String.format("Id: %s Name: %s Active: %s Blocked: %b",
Base64.encodeBytes(group.groupId), group.name, group.active, group.blocked));
Base64.encodeBytes(group.groupId), group.name, group.members.contains(username), group.blocked));
}
}
@ -40,7 +40,7 @@ public class ListGroupsCommand implements LocalCommand {
boolean detailed = ns.getBoolean("detailed");
for (GroupInfo group : groups) {
printGroup(group, detailed);
printGroup(group, detailed, m.getUsername());
}
return 0;
}