more correct fallback for unknown join conditions

This commit is contained in:
Henry Hiles 2026-10-22 14:32:58 -04:00
commit fcfe4eed1e
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 5 additions and 0 deletions

View file

@ -384,6 +384,8 @@ class RoomSettingsSectionsController(final String roomId)
)) { )) {
(null, 0) => description, (null, 0) => description,
(final alias?, 0) => alias, (final alias?, 0) => alias,
(final alias?, 1) =>
"$alias and ${canonicalAlias.altAliases.first}",
(final alias?, final others) => (final alias?, final others) =>
"$alias and $others more", "$alias and $others more",
(null, _) => canonicalAlias.altAliases.join(", "), (null, _) => canonicalAlias.altAliases.join(", "),

View file

@ -21,6 +21,8 @@ sealed class JoinRulesContent extends Content with _$JoinRulesContent {
@JsonSerializable() @JsonSerializable()
class const AllowCondition({ class const AllowCondition({
final String? roomId, final String? roomId,
@JsonKey(unknownEnumValue: AllowConditionType.unknown)
required final AllowConditionType type, required final AllowConditionType type,
}) with _$AllowCondition { }) with _$AllowCondition {
Map<String, Object?> toJson() => _$AllowConditionToJson(this); Map<String, Object?> toJson() => _$AllowConditionToJson(this);
@ -32,4 +34,5 @@ class const AllowCondition({
enum AllowConditionType { enum AllowConditionType {
@JsonValue("m.room_membership") @JsonValue("m.room_membership")
membership, membership,
unknown,
} }