Skip to content

Commit

Permalink
bridgev2/backfill: respect DontBridge flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 4, 2024
1 parent 6c8519d commit e750881
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bridgev2/portalbackfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,6 @@ func (portal *Portal) compileBatchMessage(ctx context.Context, source *UserLogin
partIDs = append(partIDs, part.ID)
portal.applyRelationMeta(part.Content, replyTo, threadRoot, prevThreadEvent)
evtID := portal.Bridge.Matrix.GenerateDeterministicEventID(portal.MXID, portal.PortalKey, msg.ID, part.ID)
out.Events = append(out.Events, &event.Event{
Sender: intent.GetMXID(),
Type: part.Type,
Timestamp: msg.Timestamp.UnixMilli(),
ID: evtID,
RoomID: portal.MXID,
Content: event.Content{
Parsed: part.Content,
Raw: part.Extra,
},
})
dbMessage := &database.Message{
ID: msg.ID,
PartID: part.ID,
Expand All @@ -327,6 +316,22 @@ func (portal *Portal) compileBatchMessage(ctx context.Context, source *UserLogin
ReplyTo: ptr.Val(msg.ReplyTo),
Metadata: part.DBMetadata,
}
if part.DontBridge {
dbMessage.SetFakeMXID()
out.DBMessages = append(out.DBMessages, dbMessage)
continue
}
out.Events = append(out.Events, &event.Event{
Sender: intent.GetMXID(),
Type: part.Type,
Timestamp: msg.Timestamp.UnixMilli(),
ID: evtID,
RoomID: portal.MXID,
Content: event.Content{
Parsed: part.Content,
Raw: part.Extra,
},
})
if firstPart == nil {
firstPart = dbMessage
}
Expand Down

0 comments on commit e750881

Please sign in to comment.