Comment on escaped dots

This commit is contained in:
Kegan Dougal 2024-04-26 12:16:39 +01:00
parent 0af85096aa
commit 9620a624d7

View File

@ -274,6 +274,7 @@ func (h *Handler) Accumulate(ctx context.Context, userID, deviceID, roomID strin
for i := range timeline.Events {
// Delete MSC4115 field as it isn't accurate when we reuse the same event for >1 user
timeline.Events[i], _ = sjson.DeleteBytes(timeline.Events[i], "unsigned.membership")
// escape .'s in the key name
timeline.Events[i], _ = sjson.DeleteBytes(timeline.Events[i], `unsigned.io\.element\.msc4115\.membership`)
parsed := gjson.ParseBytes(timeline.Events[i])
eventID := parsed.Get("event_id").Str
@ -377,6 +378,7 @@ func (h *Handler) Accumulate(ctx context.Context, userID, deviceID, roomID strin
func (h *Handler) Initialise(ctx context.Context, roomID string, state []json.RawMessage) error {
for i := range state { // Delete MSC4115 field as it isn't accurate when we reuse the same event for >1 user
state[i], _ = sjson.DeleteBytes(state[i], "unsigned.membership")
// escape .'s in the key name
state[i], _ = sjson.DeleteBytes(state[i], `unsigned.io\.element\.msc4115\.membership`)
}
res, err := h.Store.Initialise(roomID, state)