From d42c9b5dbc1276f18a29da5a024f7778e11363c9 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Tue, 12 Feb 2019 08:46:18 -0800 Subject: [PATCH] Ensure the group shortstring in the action bar is up-to-date. There were situations where adding/removing members from a group would update the group member list, but the short string (the little text listing the first couple members of the group) wouldn't be updated until you left the screen and came back. --- .../securesms/database/GroupDatabase.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/org/thoughtcrime/securesms/database/GroupDatabase.java b/src/org/thoughtcrime/securesms/database/GroupDatabase.java index 490d3ee030..0cc57379ef 100644 --- a/src/org/thoughtcrime/securesms/database/GroupDatabase.java +++ b/src/org/thoughtcrime/securesms/database/GroupDatabase.java @@ -248,6 +248,10 @@ public class GroupDatabase extends Database { databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?", new String[] {groupId}); + + Recipient.applyCached(Address.fromSerialized(groupId), recipient -> { + recipient.setParticipants(Stream.of(members).map(a -> Recipient.from(context, a, false)).toList()); + }); } public void remove(String groupId, Address source) { @@ -259,6 +263,14 @@ public class GroupDatabase extends Database { databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?", new String[] {groupId}); + + Recipient.applyCached(Address.fromSerialized(groupId), recipient -> { + List current = recipient.getParticipants(); + Recipient removal = Recipient.from(context, source, false); + + current.remove(removal); + recipient.setParticipants(current); + }); } private List
getCurrentMembers(String groupId) {