kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix story linking from private story reply.
rodzic
c3c8f8e7e6
commit
7af94f60ae
|
@ -191,6 +191,24 @@ class StorySendTable(context: Context, databaseHelper: SignalDatabase) : Databas
|
||||||
return messageIds
|
return messageIds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getStoryMessageFor(recipientId: RecipientId, timestamp: Long): MessageId? {
|
||||||
|
readableDatabase.query(
|
||||||
|
TABLE_NAME,
|
||||||
|
arrayOf(MESSAGE_ID),
|
||||||
|
"$RECIPIENT_ID = ? AND $SENT_TIMESTAMP = ?",
|
||||||
|
SqlUtil.buildArgs(recipientId, timestamp),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
"1"
|
||||||
|
).use { cursor ->
|
||||||
|
if (cursor.moveToFirst()) {
|
||||||
|
return MessageId(cursor.requireLong(MESSAGE_ID))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
override fun remapRecipient(oldId: RecipientId, newId: RecipientId) {
|
override fun remapRecipient(oldId: RecipientId, newId: RecipientId) {
|
||||||
val query = "$RECIPIENT_ID = ?"
|
val query = "$RECIPIENT_ID = ?"
|
||||||
val args = SqlUtil.buildArgs(oldId)
|
val args = SqlUtil.buildArgs(oldId)
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.thoughtcrime.securesms.crypto.SecurityEvent;
|
||||||
import org.thoughtcrime.securesms.database.AttachmentTable;
|
import org.thoughtcrime.securesms.database.AttachmentTable;
|
||||||
import org.thoughtcrime.securesms.database.CallTable;
|
import org.thoughtcrime.securesms.database.CallTable;
|
||||||
import org.thoughtcrime.securesms.database.GroupTable;
|
import org.thoughtcrime.securesms.database.GroupTable;
|
||||||
|
import org.thoughtcrime.securesms.database.StorySendTable;
|
||||||
import org.thoughtcrime.securesms.database.model.GroupRecord;
|
import org.thoughtcrime.securesms.database.model.GroupRecord;
|
||||||
import org.thoughtcrime.securesms.database.GroupReceiptTable;
|
import org.thoughtcrime.securesms.database.GroupReceiptTable;
|
||||||
import org.thoughtcrime.securesms.database.GroupReceiptTable.GroupReceiptInfo;
|
import org.thoughtcrime.securesms.database.GroupReceiptTable.GroupReceiptInfo;
|
||||||
|
@ -1750,12 +1751,20 @@ public final class MessageContentProcessor {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId());
|
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId());
|
||||||
|
RecipientId selfId = Recipient.self().getId();
|
||||||
ParentStoryId parentStoryId;
|
ParentStoryId parentStoryId;
|
||||||
QuoteModel quoteModel = null;
|
QuoteModel quoteModel = null;
|
||||||
long expiresInMillis = 0L;
|
long expiresInMillis = 0L;
|
||||||
|
MessageId storyMessageId = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MessageId storyMessageId = database.getStoryId(storyAuthorRecipient, storyContext.getSentTimestamp());
|
if (selfId.equals(storyAuthorRecipient)) {
|
||||||
|
storyMessageId = SignalDatabase.storySends().getStoryMessageFor(senderRecipient.getId(), storyContext.getSentTimestamp());
|
||||||
|
}
|
||||||
|
if (storyMessageId == null) {
|
||||||
|
storyMessageId = database.getStoryId(storyAuthorRecipient, storyContext.getSentTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
|
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
|
||||||
Recipient threadRecipient = Objects.requireNonNull(SignalDatabase.threads().getRecipientForThreadId(story.getThreadId()));
|
Recipient threadRecipient = Objects.requireNonNull(SignalDatabase.threads().getRecipientForThreadId(story.getThreadId()));
|
||||||
boolean groupStory = threadRecipient.isActiveGroup();
|
boolean groupStory = threadRecipient.isActiveGroup();
|
||||||
|
|
Ładowanie…
Reference in New Issue