Remove sus conversation data filtering
This commit is contained in:
parent
69764df5f8
commit
c88187b99f
1 changed files with 0 additions and 27 deletions
27
user.go
27
user.go
|
@ -996,30 +996,6 @@ func (user *User) Logout(state status.BridgeState, unpair bool) (logoutOK bool)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func conversationDataIsSus(portal *Portal, v *gmproto.Conversation) bool {
|
|
||||||
if !portal.IsPrivateChat() {
|
|
||||||
// Group chats hopefully never get bad updates
|
|
||||||
return false
|
|
||||||
} else if v.IsGroupChat {
|
|
||||||
// Group chat update for a DM is always sus
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
count := 0
|
|
||||||
mainName := ""
|
|
||||||
for _, pcp := range v.Participants {
|
|
||||||
if !pcp.IsMe {
|
|
||||||
if count == 0 {
|
|
||||||
mainName = pcp.FullName
|
|
||||||
count++
|
|
||||||
} else if mainName != pcp.FullName {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If there are multiple names in a DM, that's sus even if it's not marked as a group
|
|
||||||
return count > 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (user *User) syncConversation(v *gmproto.Conversation, source string) {
|
func (user *User) syncConversation(v *gmproto.Conversation, source string) {
|
||||||
updateType := v.GetStatus()
|
updateType := v.GetStatus()
|
||||||
portal := user.GetPortalByID(v.GetConversationID())
|
portal := user.GetPortalByID(v.GetConversationID())
|
||||||
|
@ -1057,9 +1033,6 @@ func (user *User) syncConversation(v *gmproto.Conversation, source string) {
|
||||||
if v.Participants == nil {
|
if v.Participants == nil {
|
||||||
log.Debug().Msg("Not syncing conversation with nil participants")
|
log.Debug().Msg("Not syncing conversation with nil participants")
|
||||||
return
|
return
|
||||||
} else if conversationDataIsSus(portal, v) {
|
|
||||||
log.Warn().Msg("Ignoring suspicious update for private chat")
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
log.Debug().Msg("Syncing existing portal")
|
log.Debug().Msg("Syncing existing portal")
|
||||||
portal.UpdateMetadata(ctx, user, v)
|
portal.UpdateMetadata(ctx, user, v)
|
||||||
|
|
Loading…
Reference in a new issue