Use getRegisteredUsers instead of getContacts for updating v1 group

Fixes #437
This commit is contained in:
AsamK 2021-01-17 16:52:10 +01:00
parent a80e26896a
commit 70690fef36

View file

@ -121,7 +121,6 @@ import org.whispersystems.signalservice.api.messages.multidevice.StickerPackOper
import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage; import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage;
import org.whispersystems.signalservice.api.profiles.ProfileAndCredential; import org.whispersystems.signalservice.api.profiles.ProfileAndCredential;
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile; import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException; import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException;
import org.whispersystems.signalservice.api.util.InvalidNumberException; import org.whispersystems.signalservice.api.util.InvalidNumberException;
@ -773,12 +772,10 @@ public class Manager implements Closeable {
newE164Members.add(member.getNumber().get()); newE164Members.add(member.getNumber().get());
} }
final List<ContactTokenDetails> contacts = accountManager.getContacts(newE164Members); final Map<String, UUID> registeredUsers = getRegisteredUsers(newE164Members);
if (contacts.size() != newE164Members.size()) { if (registeredUsers.size() != newE164Members.size()) {
// Some of the new members are not registered on Signal // Some of the new members are not registered on Signal
for (ContactTokenDetails contact : contacts) { newE164Members.removeAll(registeredUsers.keySet());
newE164Members.remove(contact.getNumber());
}
throw new IOException("Failed to add members " throw new IOException("Failed to add members "
+ String.join(", ", newE164Members) + String.join(", ", newE164Members)
+ " to group: Not registered on Signal"); + " to group: Not registered on Signal");