Skip to content

Commit

Permalink
fixup! Adapt message requests to support invite flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-signal committed May 12, 2020
1 parent 2844d5b commit 8e6066d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class ProfileKeySendJob extends BaseJob {
private final long threadId;
private final List<RecipientId> recipients;

/**
* Suitable for a 1:1 conversation or a GV1 group only.
*/
@WorkerThread
public static ProfileKeySendJob create(@NonNull Context context, long threadId) {
Recipient conversationRecipient = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadId);
Expand All @@ -49,6 +52,10 @@ public static ProfileKeySendJob create(@NonNull Context context, long threadId)
throw new AssertionError("We have a thread but no recipient!");
}

if (conversationRecipient.isPushV2Group()) {
throw new AssertionError("Do not send profile keys directly for GV2");
}

List<RecipientId> recipients = conversationRecipient.isGroup() ? Stream.of(conversationRecipient.getParticipants()).map(Recipient::getId).toList()
: Stream.of(conversationRecipient.getId()).toList();

Expand Down

0 comments on commit 8e6066d

Please sign in to comment.