client: support TG -> Matrix disappearing messages

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-10-08 14:02:52 -06:00
parent 132585de34
commit b0e6dcb1d6
3 changed files with 29 additions and 1 deletions
+16
View File
@@ -166,6 +166,22 @@ func (c *TelegramClient) convertToMatrix(ctx context.Context, portal *bridgev2.P
}
}
if disappearingSetting == nil {
// The TTL is either included in the message, or it's on the portal's
// metadata.
if ttl, ok := msg.GetTTLPeriod(); ok {
cm.Disappear = database.DisappearingSetting{
Type: database.DisappearingTypeAfterSend,
Timer: time.Duration(ttl) * time.Second,
}
} else if portal.Metadata.(*PortalMetadata).MessagesTTL > 0 {
cm.Disappear = database.DisappearingSetting{
Type: database.DisappearingTypeAfterSend,
Timer: time.Duration(ttl) * time.Second,
}
}
}
return
}