Fix group chat filters

This commit is contained in:
Andrea Maria Piana 2021-05-31 16:35:14 +02:00
parent 319461e9b7
commit af1e47c258
4 changed files with 7 additions and 6 deletions

View File

@ -72,7 +72,7 @@ func (m *Messenger) CreatePublicChat(request *requests.CreatePublicChat) (*Messe
if err != nil {
return nil, err
}
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - uint32(defaultSyncPeriod)
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - defaultSyncPeriod
chat.SyncedTo = timestamp
chat.SyncedFrom = timestamp
}
@ -138,7 +138,7 @@ func (m *Messenger) CreateProfileChat(request *requests.CreateProfileChat) (*Mes
if err != nil {
return nil, err
}
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - uint32(defaultSyncPeriod)
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - defaultSyncPeriod
chat.SyncedTo = timestamp
chat.SyncedFrom = timestamp
}
@ -195,7 +195,7 @@ func (m *Messenger) CreateOneToOneChat(request *requests.CreateOneToOneChat) (*M
if err != nil {
return nil, err
}
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - uint32(defaultSyncPeriod)
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - defaultSyncPeriod
chat.SyncedTo = timestamp
chat.SyncedFrom = timestamp
}

View File

@ -172,7 +172,7 @@ func (m *Messenger) joinCommunity(communityID types.HexBytes) (*MessengerRespons
return nil, err
}
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - uint32(defaultSyncPeriod)
timestamp := uint32(m.getTimesource().GetCurrentTime()/1000) - defaultSyncPeriod
for idx := range chats {
chats[idx].SyncedTo = timestamp
chats[idx].SyncedFrom = timestamp

View File

@ -172,7 +172,7 @@ func (m *Messenger) defaultSyncPeriod() (uint32, error) {
if err != nil {
return 0, err
}
return uint32(m.getTimesource().GetCurrentTime()/1000) - uint32(defaultSyncPeriod), nil
return uint32(m.getTimesource().GetCurrentTime()/1000) - defaultSyncPeriod, nil
}
// calculateSyncPeriod caps the sync period to the default

View File

@ -239,7 +239,8 @@ func (f *FiltersManager) FiltersByIdentities(identities []string) []*Filter {
var filters []*Filter
for _, filter := range f.filters {
if identitiesMap[filter.Identity] {
// Pre-pend 0x before comparing
if identitiesMap["0x"+filter.Identity] {
filters = append(filters, filter)
}
}