mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Revert remote delete/edit send threshold to 3 hours.
This commit is contained in:
@@ -13,7 +13,9 @@ import kotlin.time.Duration.Companion.milliseconds
|
||||
*/
|
||||
object MessageConstraintsUtil {
|
||||
private val RECEIVE_THRESHOLD = TimeUnit.DAYS.toMillis(2)
|
||||
private val SEND_THRESHOLD = TimeUnit.DAYS.toMillis(1)
|
||||
|
||||
private val REMOTE_DELETE_SEND_THRESHOLD = TimeUnit.HOURS.toMillis(3)
|
||||
private val EDIT_SEND_THRESHOLD = TimeUnit.DAYS.toMillis(1)
|
||||
|
||||
const val MAX_EDIT_COUNT = 10
|
||||
|
||||
@@ -49,7 +51,7 @@ object MessageConstraintsUtil {
|
||||
|
||||
@JvmStatic
|
||||
fun getEditMessageThresholdHours(): Int {
|
||||
return SEND_THRESHOLD.milliseconds.inWholeHours.toInt()
|
||||
return EDIT_SEND_THRESHOLD.milliseconds.inWholeHours.toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +64,7 @@ object MessageConstraintsUtil {
|
||||
} else {
|
||||
targetMessage
|
||||
}
|
||||
return isValidRemoteDeleteSend(originalMessage, currentTime) &&
|
||||
return isValidRemoteDeleteSend(originalMessage, currentTime, EDIT_SEND_THRESHOLD) &&
|
||||
targetMessage.revisionNumber < MAX_EDIT_COUNT &&
|
||||
!targetMessage.isViewOnceMessage() &&
|
||||
!targetMessage.hasAudio() &&
|
||||
@@ -77,7 +79,7 @@ object MessageConstraintsUtil {
|
||||
return isValidEditMessageSend(targetMessage, targetMessage.dateSent)
|
||||
}
|
||||
|
||||
private fun isValidRemoteDeleteSend(message: MessageRecord, currentTime: Long): Boolean {
|
||||
private fun isValidRemoteDeleteSend(message: MessageRecord, currentTime: Long, validDuration: Long = REMOTE_DELETE_SEND_THRESHOLD): Boolean {
|
||||
return !message.isUpdate &&
|
||||
message.isOutgoing &&
|
||||
message.isPush &&
|
||||
@@ -85,7 +87,7 @@ object MessageConstraintsUtil {
|
||||
!message.isRemoteDelete &&
|
||||
!message.hasGiftBadge() &&
|
||||
!message.isPaymentNotification &&
|
||||
(currentTime - message.dateSent < SEND_THRESHOLD || message.toRecipient.isSelf)
|
||||
(currentTime - message.dateSent < validDuration || message.toRecipient.isSelf)
|
||||
}
|
||||
|
||||
private fun isSelf(recipientId: RecipientId): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user