Skip to content

Commit

Permalink
Remove MMS groups from message request logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal committed Mar 31, 2020
1 parent 24528bf commit 2f879ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,17 @@ public GroupId.Mms getOrCreateMmsGroupForMembers(List<RecipientId> members) {
}
}

public List<String> getGroupNamesContainingMember(RecipientId recipientId) {
return Stream.of(getGroupsContainingMember(recipientId))
public List<String> getPushGroupNamesContainingMember(RecipientId recipientId) {
return Stream.of(getPushGroupsContainingMember(recipientId))
.map(GroupRecord::getTitle)
.toList();
}

public List<GroupRecord> getGroupsContainingMember(RecipientId recipientId) {
public List<GroupRecord> getPushGroupsContainingMember(RecipientId recipientId) {
SQLiteDatabase database = databaseHelper.getReadableDatabase();
String table = TABLE_NAME + " INNER JOIN " + ThreadDatabase.TABLE_NAME + " ON " + TABLE_NAME + "." + RECIPIENT_ID + " = " + ThreadDatabase.TABLE_NAME + "." + ThreadDatabase.RECIPIENT_ID;
String query = MEMBERS + " LIKE ?";
String[] args = new String[]{"%" + recipientId.serialize() + "%"};
String query = MEMBERS + " LIKE ? AND " + MMS + " = ?";
String[] args = new String[]{"%" + recipientId.serialize() + "%", "0"};
String orderBy = ThreadDatabase.TABLE_NAME + "." + ThreadDatabase.DATE + " DESC";

List<GroupRecord> groups = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class MessageRequestRepository {
void getGroups(@NonNull RecipientId recipientId, @NonNull Consumer<List<String>> onGroupsLoaded) {
executor.execute(() -> {
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
onGroupsLoaded.accept(groupDatabase.getGroupNamesContainingMember(recipientId));
onGroupsLoaded.accept(groupDatabase.getPushGroupNamesContainingMember(recipientId));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private static boolean noSecureMessagesInThread(@NonNull Context context, long t

@WorkerThread
private static boolean isProfileSharedViaGroup(@NonNull Context context, @NonNull Recipient recipient) {
return Stream.of(DatabaseFactory.getGroupDatabase(context).getGroupsContainingMember(recipient.getId()))
return Stream.of(DatabaseFactory.getGroupDatabase(context).getPushGroupsContainingMember(recipient.getId()))
.anyMatch(group -> Recipient.resolved(group.getRecipientId()).isProfileSharing());
}
}

0 comments on commit 2f879ce

Please sign in to comment.