mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-06 22:15:43 +01:00
Improve group story reply and reaction validations.
This commit is contained in:
committed by
Cody Henthorne
parent
3d05bc3471
commit
d33385d1b2
@@ -428,6 +428,14 @@ object DataMessageProcessor {
|
||||
try {
|
||||
val storyId = SignalDatabase.messages.getStoryId(authorRecipientId, sentTimestamp).id
|
||||
|
||||
val storyThreadRecipient: Recipient = SignalDatabase.threads.getRecipientForThreadId(SignalDatabase.messages.getMessageRecord(storyId).threadId)!!
|
||||
val storyGroupRecord: GroupRecord? = SignalDatabase.groups.getGroup(storyThreadRecipient.id).orNull()
|
||||
val storyGroupId: GroupId? = storyGroupRecord?.id?.takeIf { storyGroupRecord.isActive }
|
||||
if (storyGroupId != groupId) {
|
||||
warn(envelope.clientTimestamp!!, "Story reaction target does not belong to the same conversation as the incoming message. Dropping reaction.")
|
||||
return null
|
||||
}
|
||||
|
||||
if (groupId != null) {
|
||||
parentStoryId = GroupReply(storyId)
|
||||
} else if (SignalDatabase.storySends.canReply(senderRecipientId, sentTimestamp)) {
|
||||
@@ -748,6 +756,12 @@ object DataMessageProcessor {
|
||||
val groupRecord: GroupRecord? = SignalDatabase.groups.getGroup(threadRecipient.id).orNull()
|
||||
val groupStory: Boolean = groupRecord?.isActive ?: false
|
||||
|
||||
val storyGroupId: GroupId? = groupRecord?.id?.takeIf { groupStory }
|
||||
if (storyGroupId != groupId) {
|
||||
warn(envelope.clientTimestamp!!, "Story reply target does not belong to the same conversation as the incoming message. Dropping reply.")
|
||||
return null
|
||||
}
|
||||
|
||||
if (!groupStory) {
|
||||
threadRecipient = senderRecipient
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user