mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Fix remote delete for private stories.
This commit is contained in:
committed by
Cody Henthorne
parent
b5e0991f5e
commit
6b6e9e92e8
@@ -189,6 +189,7 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns
|
||||
public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId);
|
||||
public abstract @NonNull MessageId getStoryId(@NonNull RecipientId authorId, long sentTimestamp) throws NoSuchMessageException;
|
||||
public abstract int getNumberOfStoryReplies(long parentStoryId);
|
||||
public abstract boolean containsStories(long threadId);
|
||||
public abstract boolean hasSelfReplyInStory(long parentStoryId);
|
||||
public abstract @NonNull Cursor getStoryReplies(long parentStoryId);
|
||||
public abstract long getUnreadStoryCount();
|
||||
|
||||
@@ -708,6 +708,18 @@ public class MmsDatabase extends MessageDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsStories(long threadId) {
|
||||
SQLiteDatabase db = databaseHelper.getSignalReadableDatabase();
|
||||
String[] columns = new String[]{"1"};
|
||||
String where = THREAD_ID_WHERE + " AND " + STORY_TYPE + " > 0";
|
||||
String[] whereArgs = SqlUtil.buildArgs(threadId);
|
||||
|
||||
try (Cursor cursor = db.query(TABLE_NAME, columns, where, whereArgs, null, null, null, "1")) {
|
||||
return cursor != null && cursor.moveToNext();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSelfReplyInStory(long parentStoryId) {
|
||||
SQLiteDatabase db = databaseHelper.getSignalReadableDatabase();
|
||||
|
||||
@@ -1424,6 +1424,11 @@ public class SmsDatabase extends MessageDatabase {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsStories(long threadId) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSelfReplyInStory(long parentStoryId) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -1308,7 +1308,7 @@ public class ThreadDatabase extends Database {
|
||||
try {
|
||||
record = mmsSmsDatabase.getConversationSnippet(threadId);
|
||||
} catch (NoSuchMessageException e) {
|
||||
if (allowDeletion) {
|
||||
if (allowDeletion && !SignalDatabase.mms().containsStories(threadId)) {
|
||||
deleteConversation(threadId);
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user