diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/StorySendsDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/StorySendsDatabase.kt index 7440054a8..3a13f8be9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/StorySendsDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/StorySendsDatabase.kt @@ -231,52 +231,15 @@ class StorySendsDatabase(context: Context, databaseHelper: SignalDatabase) : Dat } /** - * Gets the manifest after a change to the available distribution lists occurs. This will only include the recipients - * as specified by onlyInclude, and is meant to represent a delta rather than an entire manifest. + * Gets the manifest after a change to the available distribution lists occurs. */ - fun getSentStorySyncManifestForUpdate(sentTimestamp: Long, onlyInclude: Set): SentStorySyncManifest { + fun getSentStorySyncManifestForUpdate(sentTimestamp: Long): SentStorySyncManifest { val localManifest: SentStorySyncManifest = getLocalManifest(sentTimestamp) - val entries: List = localManifest.entries.filter { it.recipientId in onlyInclude } + val entries: List = localManifest.entries return SentStorySyncManifest(entries) } - /** - * Manifest updates should only include the specific recipients who have changes (normally, one less distribution list), - * and of those, only the ones that have a non-empty set of distribution lists. - * - * @return A set of recipients who were able to receive the deleted story, and still have other stories at the same timestamp. - */ - fun getRecipientIdsForManifestUpdate(sentTimestamp: Long, deletedMessageId: Long): Set { - // language=sql - val query = """ - SELECT $RECIPIENT_ID - FROM $TABLE_NAME - WHERE $SENT_TIMESTAMP = ? - AND $RECIPIENT_ID IN ( - SELECT $RECIPIENT_ID - FROM $TABLE_NAME - WHERE $MESSAGE_ID = ? - ) - AND $MESSAGE_ID IN ( - SELECT ${MmsDatabase.ID} - FROM ${MmsDatabase.TABLE_NAME} - WHERE ${MmsDatabase.REMOTE_DELETED} = 0 - ) - """.trimIndent() - - return readableDatabase.rawQuery(query, arrayOf(sentTimestamp, deletedMessageId)).use { cursor -> - if (cursor.count == 0) emptyList() - - val results: MutableSet = hashSetOf() - while (cursor.moveToNext()) { - results.add(RecipientId.from(CursorUtil.requireLong(cursor, RECIPIENT_ID))) - } - - results - } - } - /** * Applies the given manifest to the local database. This method will: * diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/MultiDeviceStorySendSyncJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/MultiDeviceStorySendSyncJob.kt index 975cd9379..9da1c1df5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/MultiDeviceStorySendSyncJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/MultiDeviceStorySendSyncJob.kt @@ -55,13 +55,7 @@ class MultiDeviceStorySendSyncJob private constructor(parameters: Parameters, pr override fun getFactoryKey(): String = KEY override fun onRun() { - val recipientIds = SignalDatabase.storySends.getRecipientIdsForManifestUpdate(sentTimestamp, deletedMessageId) - if (recipientIds.isEmpty()) { - Log.i(TAG, "No recipients requiring a manifest update. Dropping.") - return - } - - val updateManifest = SignalDatabase.storySends.getSentStorySyncManifestForUpdate(sentTimestamp, recipientIds) + val updateManifest = SignalDatabase.storySends.getSentStorySyncManifestForUpdate(sentTimestamp) if (updateManifest.entries.isEmpty()) { Log.i(TAG, "No entries in updated manifest. Dropping.")