mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 20:18:36 +00:00
Do not export blank profile name changes.
This commit is contained in:
@@ -103,6 +103,14 @@ object ExportSkips {
|
|||||||
return log(sentTimestamp, "Profile change from self.")
|
return log(sentTimestamp, "Profile change from self.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun emptyProfileNameChange(sentTimestamp: Long): String {
|
||||||
|
return log(sentTimestamp, "Profile name change was empty.")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun emptyLearnedProfileChange(sentTimestamp: Long): String {
|
||||||
|
return log(sentTimestamp, "Learned profile update was empty.")
|
||||||
|
}
|
||||||
|
|
||||||
private fun log(sentTimestamp: Long, message: String): String {
|
private fun log(sentTimestamp: Long, message: String): String {
|
||||||
return "[SKIP][$sentTimestamp] $message"
|
return "[SKIP][$sentTimestamp] $message"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.signal.core.util.EventTimer
|
|||||||
import org.signal.core.util.Hex
|
import org.signal.core.util.Hex
|
||||||
import org.signal.core.util.ParallelEventTimer
|
import org.signal.core.util.ParallelEventTimer
|
||||||
import org.signal.core.util.concurrent.SignalExecutors
|
import org.signal.core.util.concurrent.SignalExecutors
|
||||||
|
import org.signal.core.util.isNotNullOrBlank
|
||||||
import org.signal.core.util.logging.Log
|
import org.signal.core.util.logging.Log
|
||||||
import org.signal.core.util.nullIfBlank
|
import org.signal.core.util.nullIfBlank
|
||||||
import org.signal.core.util.nullIfEmpty
|
import org.signal.core.util.nullIfEmpty
|
||||||
@@ -578,13 +579,21 @@ private fun BackupMessageRecord.toRemoteProfileChangeUpdate(): ChatUpdateMessage
|
|||||||
?: Base64.decodeOrNull(this.body)?.let { ProfileChangeDetails.ADAPTER.decode(it) }
|
?: Base64.decodeOrNull(this.body)?.let { ProfileChangeDetails.ADAPTER.decode(it) }
|
||||||
|
|
||||||
return if (profileChangeDetails?.profileNameChange != null) {
|
return if (profileChangeDetails?.profileNameChange != null) {
|
||||||
if (profileChangeDetails.profileNameChange.previous.isNotEmpty() && profileChangeDetails.profileNameChange.newValue.isNotEmpty()) {
|
if (profileChangeDetails.profileNameChange.previous.isNotBlank() && profileChangeDetails.profileNameChange.newValue.isNotBlank()) {
|
||||||
ChatUpdateMessage(profileChange = ProfileChangeChatUpdate(previousName = profileChangeDetails.profileNameChange.previous, newName = profileChangeDetails.profileNameChange.newValue))
|
ChatUpdateMessage(profileChange = ProfileChangeChatUpdate(previousName = profileChangeDetails.profileNameChange.previous, newName = profileChangeDetails.profileNameChange.newValue))
|
||||||
} else {
|
} else {
|
||||||
|
Log.w(TAG, ExportSkips.emptyProfileNameChange(this.dateSent))
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
} else if (profileChangeDetails?.learnedProfileName != null) {
|
} else if (profileChangeDetails?.learnedProfileName != null) {
|
||||||
ChatUpdateMessage(learnedProfileChange = LearnedProfileChatUpdate(e164 = profileChangeDetails.learnedProfileName.e164?.e164ToLong(), username = profileChangeDetails.learnedProfileName.username))
|
val e164 = profileChangeDetails.learnedProfileName.e164?.e164ToLong()
|
||||||
|
val username = profileChangeDetails.learnedProfileName.username
|
||||||
|
if (e164 != null || username.isNotNullOrBlank()) {
|
||||||
|
ChatUpdateMessage(learnedProfileChange = LearnedProfileChatUpdate(e164 = e164, username = username))
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, ExportSkips.emptyLearnedProfileChange(this.dateSent))
|
||||||
|
null
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user