Include m.room.encryption state events in timeline in sync filter
This commit is contained in:
parent
f3854524bc
commit
45f71dbaa3
@ -36,6 +36,7 @@ import (
|
||||
type AuthCache struct {
|
||||
NextBatch string `yaml:"next_batch"`
|
||||
FilterID string `yaml:"filter_id"`
|
||||
FilterVersion int `yaml:"filter_version"`
|
||||
InitialSyncDone bool `yaml:"initial_sync_done"`
|
||||
}
|
||||
|
||||
@ -262,12 +263,18 @@ func (config *Config) GetUserID() id.UserID {
|
||||
return config.UserID
|
||||
}
|
||||
|
||||
const FilterVersion = 1
|
||||
|
||||
func (config *Config) SaveFilterID(_ id.UserID, filterID string) {
|
||||
config.AuthCache.FilterID = filterID
|
||||
config.AuthCache.FilterVersion = FilterVersion
|
||||
config.SaveAuthCache()
|
||||
}
|
||||
|
||||
func (config *Config) LoadFilterID(_ id.UserID) string {
|
||||
if config.AuthCache.FilterVersion != FilterVersion {
|
||||
return ""
|
||||
}
|
||||
return config.AuthCache.FilterID
|
||||
}
|
||||
|
||||
|
@ -226,12 +226,7 @@ func (s *GomuksSyncer) OnFailedSync(res *mautrix.RespSync, err error) (time.Dura
|
||||
|
||||
// GetFilterJSON returns a filter with a timeline limit of 50.
|
||||
func (s *GomuksSyncer) GetFilterJSON(_ id.UserID) *mautrix.Filter {
|
||||
return &mautrix.Filter{
|
||||
Room: mautrix.RoomFilter{
|
||||
IncludeLeave: false,
|
||||
State: mautrix.FilterPart{
|
||||
LazyLoadMembers: true,
|
||||
Types: []event.Type{
|
||||
stateEvents := []event.Type{
|
||||
event.StateMember,
|
||||
event.StateRoomName,
|
||||
event.StateTopic,
|
||||
@ -239,24 +234,24 @@ func (s *GomuksSyncer) GetFilterJSON(_ id.UserID) *mautrix.Filter {
|
||||
event.StatePowerLevels,
|
||||
event.StateTombstone,
|
||||
event.StateEncryption,
|
||||
},
|
||||
},
|
||||
Timeline: mautrix.FilterPart{
|
||||
LazyLoadMembers: true,
|
||||
Types: []event.Type{
|
||||
}
|
||||
messageEvents := []event.Type{
|
||||
event.EventMessage,
|
||||
event.EventRedaction,
|
||||
event.EventEncrypted,
|
||||
event.EventSticker,
|
||||
event.EventReaction,
|
||||
|
||||
event.StateMember,
|
||||
event.StateRoomName,
|
||||
event.StateTopic,
|
||||
event.StateCanonicalAlias,
|
||||
event.StatePowerLevels,
|
||||
event.StateTombstone,
|
||||
}
|
||||
return &mautrix.Filter{
|
||||
Room: mautrix.RoomFilter{
|
||||
IncludeLeave: false,
|
||||
State: mautrix.FilterPart{
|
||||
LazyLoadMembers: true,
|
||||
Types: stateEvents,
|
||||
},
|
||||
Timeline: mautrix.FilterPart{
|
||||
LazyLoadMembers: true,
|
||||
Types: append(messageEvents, stateEvents...),
|
||||
Limit: 50,
|
||||
},
|
||||
Ephemeral: mautrix.FilterPart{
|
||||
|
Loading…
Reference in New Issue
Block a user