Parcourir la source

Don't deduplicate group create events with empty create key

Tulir Asokan il y a 2 ans
Parent
commit
5eba642a4d
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      user.go

+ 5 - 1
user.go

@@ -1304,8 +1304,12 @@ func (user *User) markUnread(portal *Portal, unread bool) {
 
 func (user *User) handleGroupCreate(evt *events.JoinedGroup) {
 	portal := user.GetPortalByJID(evt.JID)
+	if evt.CreateKey == "" && len(portal.MXID) == 0 {
+		user.log.Debugfln("Delaying handling group create with empty key to avoid race conditions")
+		time.Sleep(5 * time.Second)
+	}
 	if len(portal.MXID) == 0 {
-		if evt.CreateKey == user.createKeyDedup {
+		if user.createKeyDedup != "" && evt.CreateKey == user.createKeyDedup {
 			user.log.Debugfln("Ignoring group create event with key %s", evt.CreateKey)
 			return
 		}