mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
event: allow omitting timers from disappearing timer capability
This commit is contained in:
parent
e9d4eeb332
commit
7b3a60742e
2 changed files with 4 additions and 3 deletions
3
event/capabilities.d.ts
vendored
3
event/capabilities.d.ts
vendored
|
|
@ -117,7 +117,8 @@ export enum DisappearingType {
|
|||
|
||||
export interface DisappearingTimerCapability {
|
||||
types: DisappearingType[]
|
||||
timers: milliseconds[]
|
||||
/** Allowed timer values. If omitted, any timer is allowed. */
|
||||
timers?: milliseconds[]
|
||||
/**
|
||||
* Whether clients should omit the empty disappearing_timer object in messages that they don't want to disappear
|
||||
*
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ type FileFeatureMap map[CapabilityMsgType]*FileFeatures
|
|||
|
||||
type DisappearingTimerCapability struct {
|
||||
Types []DisappearingType `json:"types"`
|
||||
Timers []jsontime.Milliseconds `json:"timers"`
|
||||
Timers []jsontime.Milliseconds `json:"timers,omitempty"`
|
||||
|
||||
OmitEmptyTimer bool `json:"omit_empty_timer,omitempty"`
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ func (dtc *DisappearingTimerCapability) Supports(content *BeeperDisappearingTime
|
|||
if dtc == nil || content.Type == DisappearingTypeNone {
|
||||
return true
|
||||
}
|
||||
return slices.Contains(dtc.Types, content.Type) && slices.Contains(dtc.Timers, content.Timer)
|
||||
return slices.Contains(dtc.Types, content.Type) && (dtc.Timers == nil || slices.Contains(dtc.Timers, content.Timer))
|
||||
}
|
||||
|
||||
type CapabilityMsgType = MessageType
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue