mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2025-01-20 19:32:00 +01:00
Fix handling max_initial_conversations being -1 in legacy backfill
This commit is contained in:
parent
eddd6c87bf
commit
8d93f7c036
1 changed files with 2 additions and 1 deletions
|
@ -137,6 +137,7 @@ func (user *User) backfillAll() {
|
||||||
user.zlog.Info().
|
user.zlog.Info().
|
||||||
Int("conversation_count", len(conversations)).
|
Int("conversation_count", len(conversations)).
|
||||||
Msg("Probably received all history sync blobs, now backfilling conversations")
|
Msg("Probably received all history sync blobs, now backfilling conversations")
|
||||||
|
limit := user.bridge.Config.Bridge.HistorySync.MaxInitialConversations
|
||||||
// Find the portals for all the conversations.
|
// Find the portals for all the conversations.
|
||||||
for i, conv := range conversations {
|
for i, conv := range conversations {
|
||||||
jid, err := types.ParseJID(conv.ConversationID)
|
jid, err := types.ParseJID(conv.ConversationID)
|
||||||
|
@ -152,7 +153,7 @@ func (user *User) backfillAll() {
|
||||||
Str("portal_jid", portal.Key.JID.String()).
|
Str("portal_jid", portal.Key.JID.String()).
|
||||||
Msg("Chat already has a room, deleting messages from database")
|
Msg("Chat already has a room, deleting messages from database")
|
||||||
user.bridge.DB.HistorySync.DeleteConversation(user.MXID, portal.Key.JID.String())
|
user.bridge.DB.HistorySync.DeleteConversation(user.MXID, portal.Key.JID.String())
|
||||||
} else if i < user.bridge.Config.Bridge.HistorySync.MaxInitialConversations {
|
} else if limit < 0 || i < limit {
|
||||||
err = portal.CreateMatrixRoom(user, nil, true, true)
|
err = portal.CreateMatrixRoom(user, nil, true, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
user.zlog.Err(err).Msg("Failed to create Matrix room for backfill")
|
user.zlog.Err(err).Msg("Failed to create Matrix room for backfill")
|
||||||
|
|
Loading…
Add table
Reference in a new issue