diff --git a/build.gradle.kts b/build.gradle.kts index 7f05f72..b1440a6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { alias(libs.plugins.kotlin.serialization) apply false } allprojects { - version = "5.7.1" + version = "5.7.2" group = "space.votebot" repositories { diff --git a/common/src/commonMain/kotlin/space/votebot/common/models/PollSettings.kt b/common/src/commonMain/kotlin/space/votebot/common/models/PollSettings.kt index fc113c9..e972466 100644 --- a/common/src/commonMain/kotlin/space/votebot/common/models/PollSettings.kt +++ b/common/src/commonMain/kotlin/space/votebot/common/models/PollSettings.kt @@ -80,12 +80,14 @@ public data class FinalPollSettings( /** * Merges this instance of [PollSettings] with [other] to create a [FinalPollSettings] instance. */ -public fun PollSettings.merge(other: PollSettings?): FinalPollSettings = FinalPollSettings( - deleteAfter ?: other?.deleteAfter, - (showChartAfterClose ?: other?.showChartAfterClose) != false, - maxVotes ?: other?.maxVotes ?: 1, - maxChanges ?: other?.maxChanges ?: 0, - (hideResults ?: other?.hideResults) == true, - (publicResults ?: other?.publicResults) == true, - emojiMode ?: other?.emojiMode ?: PollSettings.EmojiMode.ON -) +public fun PollSettings.merge(other: PollSettings?): FinalPollSettings { + return FinalPollSettings( + deleteAfter ?: other?.deleteAfter, + (showChartAfterClose ?: other?.showChartAfterClose) != false, + (maxVotes ?: other?.maxVotes ?: 1).takeIf { maxChanges == null || maxChanges == 1 } ?: 0, + (maxChanges ?: other?.maxChanges ?: 1).takeIf { maxVotes == null || maxVotes == 1 } ?: 0, + (hideResults ?: other?.hideResults) == true, + (publicResults ?: other?.publicResults) == true, + emojiMode ?: other?.emojiMode ?: PollSettings.EmojiMode.ON + ) +}