mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-14 23:18:43 +00:00
Allow 1:1 polls and raise character limit.
This commit is contained in:
committed by
jeffrey-signal
parent
fd635542c0
commit
f7d87f3436
@@ -29,6 +29,7 @@ import org.whispersystems.signalservice.internal.util.Util
|
||||
*/
|
||||
object EnvelopeContentValidator {
|
||||
|
||||
private const val MAX_POLL_QUESTION_CHARACTER_LENGTH = 200
|
||||
private const val MAX_POLL_CHARACTER_LENGTH = 100
|
||||
private const val MIN_POLL_OPTIONS = 2
|
||||
|
||||
@@ -167,7 +168,7 @@ object EnvelopeContentValidator {
|
||||
}
|
||||
|
||||
private fun DataMessage.PollCreate.hasInvalidPollQuestion(): Boolean {
|
||||
return this.question.isNullOrBlank() || this.question.length > MAX_POLL_CHARACTER_LENGTH
|
||||
return this.question.isNullOrBlank() || this.question.length > MAX_POLL_QUESTION_CHARACTER_LENGTH
|
||||
}
|
||||
|
||||
private fun DataMessage.PollCreate.hasInvalidPollOptions(): Boolean {
|
||||
|
||||
@@ -50,11 +50,11 @@ class EnvelopeContentValidatorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `validate - ensure polls with a question exceeding 100 characters are marked invalid`() {
|
||||
fun `validate - ensure polls with a question exceeding 200 characters are marked invalid`() {
|
||||
val content = Content(
|
||||
dataMessage = DataMessage(
|
||||
pollCreate = DataMessage.PollCreate(
|
||||
question = "abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz",
|
||||
question = "abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz",
|
||||
options = listOf("option1", "option2"),
|
||||
allowMultiple = true
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user