Ensure reactions are deleted for remote-deleted messages.
We were doing this for MmsDatabase, but not SmsDatabase. Includes a migration to cleanup any existing bad state.master
parent
8d060837ad
commit
5cdc5bc441
|
@ -373,6 +373,7 @@ public class SmsDatabase extends MessageDatabase {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(REMOTE_DELETED, 1);
|
values.put(REMOTE_DELETED, 1);
|
||||||
values.putNull(BODY);
|
values.putNull(BODY);
|
||||||
|
values.putNull(REACTIONS);
|
||||||
db.update(TABLE_NAME, values, ID_WHERE, new String[] { String.valueOf(id) });
|
db.update(TABLE_NAME, values, ID_WHERE, new String[] { String.valueOf(id) });
|
||||||
|
|
||||||
long threadId = getThreadIdForMessage(id);
|
long threadId = getThreadIdForMessage(id);
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.thoughtcrime.securesms.util.SqlUtil;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.util.Triple;
|
import org.thoughtcrime.securesms.util.Triple;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -155,8 +156,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||||
private static final int STICKER_CONTENT_TYPE_CLEANUP = 75;
|
private static final int STICKER_CONTENT_TYPE_CLEANUP = 75;
|
||||||
private static final int MENTION_CLEANUP = 76;
|
private static final int MENTION_CLEANUP = 76;
|
||||||
private static final int MENTION_CLEANUP_V2 = 77;
|
private static final int MENTION_CLEANUP_V2 = 77;
|
||||||
|
private static final int REACTION_CLEANUP = 78;
|
||||||
|
|
||||||
private static final int DATABASE_VERSION = 77;
|
private static final int DATABASE_VERSION = 78;
|
||||||
private static final String DATABASE_NAME = "signal.db";
|
private static final String DATABASE_NAME = "signal.db";
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
@ -1123,6 +1125,12 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldVersion < REACTION_CLEANUP) {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.putNull("reactions");
|
||||||
|
db.update("sms", values, "remote_deleted = ?", new String[] { "1" });
|
||||||
|
}
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
|
|
Loading…
Reference in New Issue