mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Add option to ignore cache in EnsureJoined
This commit is contained in:
parent
48e8e472a3
commit
66726fa3ee
1 changed files with 8 additions and 2 deletions
|
|
@ -66,8 +66,14 @@ func (intent *IntentAPI) EnsureRegistered() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (intent *IntentAPI) EnsureJoined(roomID id.RoomID) error {
|
||||
if intent.as.StateStore.IsInRoom(roomID, intent.UserID) {
|
||||
type EnsureJoinedParams struct {
|
||||
IgnoreCache bool
|
||||
}
|
||||
|
||||
func (intent *IntentAPI) EnsureJoined(roomID id.RoomID, extra ...EnsureJoinedParams) error {
|
||||
if len(extra) > 1 {
|
||||
panic("invalid number of extra parameters")
|
||||
} else if intent.as.StateStore.IsInRoom(roomID, intent.UserID) && (len(extra) == 0 || !extra[0].IgnoreCache) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue