Disable abridged sending

This commit is contained in:
Andrea Maria Piana 2022-11-18 10:04:38 +00:00
parent 9b670ff453
commit 1036243276
4 changed files with 5 additions and 15 deletions

View File

@ -1 +1 @@
0.115.2 0.115.3

View File

@ -5799,7 +5799,10 @@ func (m *Messenger) encodeChatEntity(chat *Chat, message common.ChatEntity) ([]b
return nil, err return nil, err
} }
encodedMessage, err = m.sender.EncodeAbridgedMembershipUpdate(group, message) // NOTE(cammellos): Disabling for now since the optimiziation is not
// applicable anymore after we changed group rules to allow
// anyone to change group details
encodedMessage, err = m.sender.EncodeMembershipUpdate(group, message)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -345,16 +345,6 @@ func (g Group) Events() []MembershipUpdateEvent {
return g.events return g.events
} }
func isInSlice(m string, set []string) bool {
for _, k := range set {
if k == m {
return true
}
}
return false
}
// AbridgedEvents returns the minimum set of events for a user to publish a post // AbridgedEvents returns the minimum set of events for a user to publish a post
// The events we want to keep: // The events we want to keep:
// 1) Chat created // 1) Chat created

View File

@ -400,7 +400,6 @@ func TestAbridgedEventsNameChanged(t *testing.T) {
nameChangedEvent2.ChatID = g.chatID nameChangedEvent2.ChatID = g.chatID
err = g.ProcessEvent(nameChangedEvent2) err = g.ProcessEvent(nameChangedEvent2)
require.NoError(t, err) require.NoError(t, err)
clock++
// Full events is 3 events // Full events is 3 events
require.Len(t, g.Events(), 3) require.Len(t, g.Events(), 3)
@ -482,7 +481,6 @@ func TestAbridgedEventsMembers(t *testing.T) {
event.ChatID = g.chatID event.ChatID = g.chatID
err = g.ProcessEvent(event) err = g.ProcessEvent(event)
require.NoError(t, err) require.NoError(t, err)
clock++
require.Len(t, g.Events(), 5) require.Len(t, g.Events(), 5)
// The previous two events, should be removed, because they have no impact // The previous two events, should be removed, because they have no impact
@ -540,7 +538,6 @@ func TestAbridgedEventsAdmins(t *testing.T) {
event.ChatID = g.chatID event.ChatID = g.chatID
err = g.ProcessEvent(event) err = g.ProcessEvent(event)
require.NoError(t, err) require.NoError(t, err)
clock++
require.Len(t, g.Events(), 3) require.Len(t, g.Events(), 3)
// All the events are relevant here, so it should be the same // All the events are relevant here, so it should be the same