Remove MMS groups from message request logic.

fork-5.53.8
Alex Hart 2020-03-31 16:00:26 -03:00 zatwierdzone przez GitHub
rodzic 24528bf101
commit 2f879ce4d6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -183,17 +183,17 @@ public final class GroupDatabase extends Database {
} }
} }
public List<String> getGroupNamesContainingMember(RecipientId recipientId) { public List<String> getPushGroupNamesContainingMember(RecipientId recipientId) {
return Stream.of(getGroupsContainingMember(recipientId)) return Stream.of(getPushGroupsContainingMember(recipientId))
.map(GroupRecord::getTitle) .map(GroupRecord::getTitle)
.toList(); .toList();
} }
public List<GroupRecord> getGroupsContainingMember(RecipientId recipientId) { public List<GroupRecord> getPushGroupsContainingMember(RecipientId recipientId) {
SQLiteDatabase database = databaseHelper.getReadableDatabase(); 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 table = TABLE_NAME + " INNER JOIN " + ThreadDatabase.TABLE_NAME + " ON " + TABLE_NAME + "." + RECIPIENT_ID + " = " + ThreadDatabase.TABLE_NAME + "." + ThreadDatabase.RECIPIENT_ID;
String query = MEMBERS + " LIKE ?"; String query = MEMBERS + " LIKE ? AND " + MMS + " = ?";
String[] args = new String[]{"%" + recipientId.serialize() + "%"}; String[] args = new String[]{"%" + recipientId.serialize() + "%", "0"};
String orderBy = ThreadDatabase.TABLE_NAME + "." + ThreadDatabase.DATE + " DESC"; String orderBy = ThreadDatabase.TABLE_NAME + "." + ThreadDatabase.DATE + " DESC";
List<GroupRecord> groups = new LinkedList<>(); List<GroupRecord> groups = new LinkedList<>();

Wyświetl plik

@ -38,7 +38,7 @@ final class MessageRequestRepository {
void getGroups(@NonNull RecipientId recipientId, @NonNull Consumer<List<String>> onGroupsLoaded) { void getGroups(@NonNull RecipientId recipientId, @NonNull Consumer<List<String>> onGroupsLoaded) {
executor.execute(() -> { executor.execute(() -> {
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context); GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
onGroupsLoaded.accept(groupDatabase.getGroupNamesContainingMember(recipientId)); onGroupsLoaded.accept(groupDatabase.getPushGroupNamesContainingMember(recipientId));
}); });
} }

Wyświetl plik

@ -235,7 +235,7 @@ public class RecipientUtil {
@WorkerThread @WorkerThread
private static boolean isProfileSharedViaGroup(@NonNull Context context, @NonNull Recipient recipient) { 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()); .anyMatch(group -> Recipient.resolved(group.getRecipientId()).isProfileSharing());
} }
} }