Disable polls from within threads but allow users to vote if the poll is a root thread message

This commit is contained in:
ariskotsomitopoulos 2021-12-15 16:31:58 +02:00
parent 20357ce5c4
commit 3acdccb339
3 changed files with 6 additions and 3 deletions

View file

@ -205,6 +205,7 @@ data class Event(
isAudioMessage() -> "sent an audio file."
isImageMessage() -> "sent an image."
isVideoMessage() -> "sent a video."
isPoll() -> "created a poll."
else -> text
}
}
@ -337,7 +338,7 @@ fun Event.isAttachmentMessage(): Boolean {
}
}
fun Event.isPoll(): Boolean = getClearType() == EventType.POLL_START || getClearType() == EventType.POLL_END
fun Event.isPoll(): Boolean = getClearType() == EventType.POLL_START || getClearType() == EventType.POLL_END
fun Event.isSticker(): Boolean = getClearType() == EventType.STICKER

View file

@ -55,7 +55,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
) : RealmMigration {
companion object {
const val SESSION_STORE_SCHEMA_VERSION = 19L
const val SESSION_STORE_SCHEMA_VERSION = 20L
}
/**

View file

@ -1448,7 +1448,9 @@ class TimelineFragment @Inject constructor(
override fun onAddAttachment() {
if (!::attachmentTypeSelector.isInitialized) {
attachmentTypeSelector = AttachmentTypeSelectorView(vectorBaseActivity, vectorBaseActivity.layoutInflater, this@TimelineFragment)
attachmentTypeSelector.setAttachmentVisibility(AttachmentTypeSelectorView.Type.POLL, vectorPreferences.labsEnablePolls())
attachmentTypeSelector.setAttachmentVisibility(
AttachmentTypeSelectorView.Type.POLL,
vectorPreferences.labsEnablePolls() && !isThreadTimeLine())
}
attachmentTypeSelector.show(views.composerLayout.views.attachmentButton, keyboardStateUtils.isKeyboardShowing)
}