mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Remove concept of 'highTrust' that is no longer necessary.
This commit is contained in:
committed by
Alex Hart
parent
d17896ea09
commit
04cf8676cc
@@ -196,7 +196,7 @@ final class GroupManagerV1 {
|
||||
static void updateGroupTimer(@NonNull Context context, @NonNull GroupId.V1 groupId, int expirationTime) {
|
||||
RecipientDatabase recipientDatabase = SignalDatabase.recipients();
|
||||
ThreadDatabase threadDatabase = SignalDatabase.threads();
|
||||
Recipient recipient = Recipient.externalGroupExact(context, groupId);
|
||||
Recipient recipient = Recipient.externalGroupExact(groupId);
|
||||
long threadId = threadDatabase.getOrCreateThreadIdFor(recipient);
|
||||
|
||||
recipientDatabase.setExpireMessages(recipient.getId(), expirationTime);
|
||||
|
||||
@@ -400,7 +400,7 @@ final class GroupManagerV2 {
|
||||
GroupManager.GroupActionResult groupActionResult = commitChangeWithConflictResolution(selfAci, change);
|
||||
|
||||
if (avatarChanged) {
|
||||
AvatarHelper.setAvatar(context, Recipient.externalGroupExact(context, groupId).getId(), avatarBytes != null ? new ByteArrayInputStream(avatarBytes) : null);
|
||||
AvatarHelper.setAvatar(context, Recipient.externalGroupExact(groupId).getId(), avatarBytes != null ? new ByteArrayInputStream(avatarBytes) : null);
|
||||
groupDatabase.onAvatarUpdated(groupId, avatarBytes != null);
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ final class GroupManagerV2 {
|
||||
|
||||
if (GroupChangeUtil.changeIsEmpty(change.build())) {
|
||||
Log.i(TAG, "Change is empty after conflict resolution");
|
||||
Recipient groupRecipient = Recipient.externalGroupExact(context, groupId);
|
||||
Recipient groupRecipient = Recipient.externalGroupExact(groupId);
|
||||
long threadId = SignalDatabase.threads().getOrCreateThreadIdFor(groupRecipient);
|
||||
|
||||
return new GroupManager.GroupActionResult(groupRecipient, threadId, 0, Collections.emptyList());
|
||||
@@ -696,7 +696,7 @@ final class GroupManagerV2 {
|
||||
final DecryptedGroup decryptedGroupState;
|
||||
final DecryptedGroup previousGroupState;
|
||||
|
||||
if (!allowWhenBlocked && Recipient.externalGroupExact(context, groupId).isBlocked()) {
|
||||
if (!allowWhenBlocked && Recipient.externalGroupExact(groupId).isBlocked()) {
|
||||
throw new GroupChangeFailedException("Group is blocked.");
|
||||
}
|
||||
|
||||
@@ -1232,7 +1232,7 @@ final class GroupManagerV2 {
|
||||
boolean sendToMembers)
|
||||
{
|
||||
GroupId.V2 groupId = GroupId.v2(masterKey);
|
||||
Recipient groupRecipient = Recipient.externalGroupExact(context, groupId);
|
||||
Recipient groupRecipient = Recipient.externalGroupExact(groupId);
|
||||
DecryptedGroupV2Context decryptedGroupV2Context = GroupProtoUtil.createDecryptedGroupV2Context(masterKey, groupMutation, signedGroupChange);
|
||||
OutgoingGroupUpdateMessage outgoingMessage = new OutgoingGroupUpdateMessage(groupRecipient,
|
||||
decryptedGroupV2Context,
|
||||
@@ -1276,7 +1276,7 @@ final class GroupManagerV2 {
|
||||
|
||||
private static @NonNull List<RecipientId> getPendingMemberRecipientIds(@NonNull List<DecryptedPendingMember> newPendingMembersList) {
|
||||
return Stream.of(DecryptedGroupUtil.pendingToUuidList(newPendingMembersList))
|
||||
.map(uuid -> RecipientId.from(ServiceId.from(uuid), null))
|
||||
.map(uuid -> RecipientId.from(ServiceId.from(uuid)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public final class GroupProtoUtil {
|
||||
return Recipient.UNKNOWN;
|
||||
}
|
||||
|
||||
return Recipient.externalPush(serviceId, null, false);
|
||||
return Recipient.externalPush(serviceId);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@@ -102,7 +102,7 @@ public final class GroupProtoUtil {
|
||||
return RecipientId.UNKNOWN;
|
||||
}
|
||||
|
||||
return RecipientId.from(serviceId, null);
|
||||
return RecipientId.from(serviceId);
|
||||
}
|
||||
|
||||
public static boolean isMember(@NonNull UUID uuid, @NonNull List<DecryptedMember> membersList) {
|
||||
|
||||
@@ -107,11 +107,11 @@ public final class GroupV1MessageProcessor {
|
||||
database.create(id, group.getName().orElse(null), members,
|
||||
avatar != null && avatar.isPointer() ? avatar.asPointer() : null, null);
|
||||
|
||||
Recipient sender = Recipient.externalHighTrustPush(context, content.getSender());
|
||||
Recipient sender = Recipient.externalPush(content.getSender());
|
||||
|
||||
if (sender.isSystemContact() || sender.isProfileSharing()) {
|
||||
Log.i(TAG, "Auto-enabling profile sharing because 'adder' is trusted. contact: " + sender.isSystemContact() + ", profileSharing: " + sender.isProfileSharing());
|
||||
SignalDatabase.recipients().setProfileSharing(Recipient.externalGroupExact(context, id).getId(), true);
|
||||
SignalDatabase.recipients().setProfileSharing(Recipient.externalGroupExact(id).getId(), true);
|
||||
}
|
||||
|
||||
return storeMessage(context, content, group, builder.build(), outgoing);
|
||||
@@ -188,7 +188,7 @@ public final class GroupV1MessageProcessor {
|
||||
@NonNull SignalServiceContent content,
|
||||
@NonNull GroupRecord record)
|
||||
{
|
||||
Recipient sender = Recipient.externalHighTrustPush(context, content.getSender());
|
||||
Recipient sender = Recipient.externalPush(content.getSender());
|
||||
|
||||
if (record.getMembers().contains(sender.getId())) {
|
||||
ApplicationDependencies.getJobManager().add(new PushGroupUpdateJob(sender.getId(), record.getId()));
|
||||
@@ -210,7 +210,7 @@ public final class GroupV1MessageProcessor {
|
||||
GroupContext.Builder builder = createGroupContext(group);
|
||||
builder.setType(GroupContext.Type.QUIT);
|
||||
|
||||
RecipientId senderId = RecipientId.fromHighTrust(content.getSender());
|
||||
RecipientId senderId = RecipientId.from(content.getSender());
|
||||
|
||||
if (members.contains(senderId)) {
|
||||
database.remove(id, senderId);
|
||||
@@ -249,7 +249,7 @@ public final class GroupV1MessageProcessor {
|
||||
} else {
|
||||
MessageDatabase smsDatabase = SignalDatabase.sms();
|
||||
String body = Base64.encodeBytes(storage.toByteArray());
|
||||
IncomingTextMessage incoming = new IncomingTextMessage(Recipient.externalHighTrustPush(context, content.getSender()).getId(), content.getSenderDevice(), content.getTimestamp(), content.getServerReceivedTimestamp(), System.currentTimeMillis(), body, Optional.of(GroupId.v1orThrow(group.getGroupId())), 0, content.isNeedsReceipt(), content.getServerUuid());
|
||||
IncomingTextMessage incoming = new IncomingTextMessage(Recipient.externalPush(content.getSender()).getId(), content.getSenderDevice(), content.getTimestamp(), content.getServerReceivedTimestamp(), System.currentTimeMillis(), body, Optional.of(GroupId.v1orThrow(group.getGroupId())), 0, content.isNeedsReceipt(), content.getServerUuid());
|
||||
IncomingGroupUpdateMessage groupMessage = new IncomingGroupUpdateMessage(incoming, storage, body);
|
||||
|
||||
Optional<InsertResult> insertResult = smsDatabase.insertMessageInbox(groupMessage);
|
||||
|
||||
@@ -151,7 +151,7 @@ public final class GroupsV1MigrationUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
Recipient recipient = Recipient.externalGroupExact(context, gv1Id);
|
||||
Recipient recipient = Recipient.externalGroupExact(gv1Id);
|
||||
long threadId = SignalDatabase.threads().getOrCreateThreadIdFor(recipient);
|
||||
|
||||
performLocalMigration(context, gv1Id, threadId, recipient);
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class LiveGroup {
|
||||
this.groupLink = new MutableLiveData<>(GroupLinkUrlAndStatus.NONE);
|
||||
}
|
||||
|
||||
SignalExecutors.BOUNDED.execute(() -> liveRecipient.postValue(Recipient.externalGroupExact(context, groupId).live()));
|
||||
SignalExecutors.BOUNDED.execute(() -> liveRecipient.postValue(Recipient.externalGroupExact(groupId).live()));
|
||||
}
|
||||
|
||||
protected static LiveData<List<GroupMemberEntry.FullMember>> mapToFullMembers(@NonNull LiveData<GroupDatabase.GroupRecord> groupRecord) {
|
||||
@@ -110,7 +110,7 @@ public final class LiveGroup {
|
||||
|
||||
return Stream.of(requestingMembersList)
|
||||
.map(requestingMember -> {
|
||||
Recipient recipient = Recipient.externalPush(ServiceId.fromByteString(requestingMember.getUuid()), null, false);
|
||||
Recipient recipient = Recipient.externalPush(ServiceId.fromByteString(requestingMember.getUuid()));
|
||||
return new GroupMemberEntry.RequestingMember(recipient, selfAdmin);
|
||||
})
|
||||
.toList();
|
||||
|
||||
@@ -109,7 +109,7 @@ public final class ChooseNewAdminActivity extends PassphraseRequiredActivity {
|
||||
|
||||
private void handleUpdateAndLeaveResult(@NonNull GroupChangeResult updateResult) {
|
||||
if (updateResult.isSuccess()) {
|
||||
String title = Recipient.externalGroupExact(this, groupId).getDisplayName(this);
|
||||
String title = Recipient.externalGroupExact(groupId).getDisplayName(this);
|
||||
Toast.makeText(this, getString(R.string.ChooseNewAdminActivity_you_left, title), Toast.LENGTH_LONG).show();
|
||||
startActivity(MainActivity.clearTop(this));
|
||||
finish();
|
||||
|
||||
@@ -449,7 +449,7 @@ public class GroupsV2StateProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
Recipient groupRecipient = Recipient.externalGroupExact(context, groupId);
|
||||
Recipient groupRecipient = Recipient.externalGroupExact(groupId);
|
||||
UUID selfUuid = serviceId.uuid();
|
||||
|
||||
DecryptedGroup decryptedGroup = groupDatabase.requireGroup(groupId)
|
||||
@@ -587,7 +587,7 @@ public class GroupsV2StateProcessor {
|
||||
.filter(c -> c != null && c.getRevision() == revisionJoinedAt)
|
||||
.findFirst()
|
||||
.map(c -> Optional.ofNullable(UuidUtil.fromByteStringOrNull(c.getEditor()))
|
||||
.map(a -> Recipient.externalPush(ServiceId.fromByteStringOrNull(c.getEditor()), null, false)))
|
||||
.map(uuid -> Recipient.externalPush(ServiceId.from(uuid))))
|
||||
.orElse(Optional.empty());
|
||||
|
||||
if (addedByOptional.isPresent()) {
|
||||
@@ -603,7 +603,7 @@ public class GroupsV2StateProcessor {
|
||||
} else if (addedBy.isSystemContact() || addedBy.isProfileSharing()) {
|
||||
Log.i(TAG, "Group 'adder' is trusted. contact: " + addedBy.isSystemContact() + ", profileSharing: " + addedBy.isProfileSharing());
|
||||
Log.i(TAG, "Added to a group and auto-enabling profile sharing");
|
||||
recipientDatabase.setProfileSharing(Recipient.externalGroupExact(context, groupId).getId(), true);
|
||||
recipientDatabase.setProfileSharing(Recipient.externalGroupExact(groupId).getId(), true);
|
||||
} else {
|
||||
Log.i(TAG, "Added to a group, but not enabling profile sharing, as 'adder' is not trusted");
|
||||
}
|
||||
@@ -612,7 +612,7 @@ public class GroupsV2StateProcessor {
|
||||
}
|
||||
} else if (selfAsPendingOptional.isPresent()) {
|
||||
Optional<Recipient> addedBy = selfAsPendingOptional.flatMap(adder -> Optional.ofNullable(UuidUtil.fromByteStringOrNull(adder.getAddedByUuid()))
|
||||
.map(a -> Recipient.externalPush(ServiceId.fromByteStringOrNull(adder.getAddedByUuid()), null, false)));
|
||||
.map(uuid -> Recipient.externalPush(ServiceId.from(uuid))));
|
||||
|
||||
if (addedBy.isPresent() && addedBy.get().isBlocked()) {
|
||||
Log.i(TAG, String.format( "Added to group %s by a blocked user %s. Leaving group.", groupId, addedBy.get().getId()));
|
||||
@@ -698,7 +698,7 @@ public class GroupsV2StateProcessor {
|
||||
}
|
||||
} else {
|
||||
MessageDatabase smsDatabase = SignalDatabase.sms();
|
||||
RecipientId sender = RecipientId.from(editor.get(), null);
|
||||
RecipientId sender = RecipientId.from(editor.get());
|
||||
IncomingTextMessage incoming = new IncomingTextMessage(sender, -1, timestamp, timestamp, timestamp, "", Optional.of(groupId), 0, false, null);
|
||||
IncomingGroupUpdateMessage groupMessage = new IncomingGroupUpdateMessage(incoming, decryptedGroupV2Context);
|
||||
Optional<MessageDatabase.InsertResult> insertResult = smsDatabase.insertMessageInbox(groupMessage);
|
||||
|
||||
Reference in New Issue
Block a user