Skip to content

Commit

Permalink
add function to check if room version is marked as stable (#408)
Browse files Browse the repository at this point in the history
Signed-off-by: `Sam Wedgwood <[email protected]>`
  • Loading branch information
swedgwood authored Aug 7, 2023
1 parent 1b697d1 commit c48e302
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eventversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ func KnownRoomVersion(verStr RoomVersion) bool {
return ok
}

// StableRoomVersion returns true if the provided room version
// is both known (i.e. KnownRoomVersion returns true) and marked
// as stable.
func StableRoomVersion(verStr RoomVersion) bool {
verImpl, ok := roomVersionMeta[verStr]
return ok && verImpl.Stable()
}

// MustGetRoomVersion is GetRoomVersion but panics if the version doesn't exist. Useful for tests.
func MustGetRoomVersion(verStr RoomVersion) IRoomVersion {
impl, err := GetRoomVersion(verStr)
Expand Down

0 comments on commit c48e302

Please sign in to comment.