Remove MMS groups from message request logic.

master
Alex Hart 2020-03-31 16:00:26 -03:00 committed by GitHub
parent 24528bf101
commit 2f879ce4d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -183,17 +183,17 @@ public final class GroupDatabase extends Database {
}
}
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<>();

View File

@ -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));
});
}

View File

@ -235,7 +235,7 @@ public class RecipientUtil {
@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());
}
}