ids: add channel ID to message ID to ensure uniqueness (#25)

This commit is contained in:
Tulir Asokan
2024-08-26 20:42:06 +03:00
committed by GitHub
parent d7508579e5
commit e3e709eec6
8 changed files with 111 additions and 40 deletions
+3 -3
View File
@@ -156,7 +156,7 @@ func (c *TelegramClient) convertToMatrix(ctx context.Context, portal *bridgev2.P
switch replyTo := replyTo.(type) {
case *tg.MessageReplyHeader:
cm.ReplyTo = &networkid.MessageOptionalPartID{
MessageID: ids.MakeMessageID(replyTo.ReplyToMsgID),
MessageID: ids.MakeMessageID(replyTo.ReplyToPeerID, replyTo.ReplyToMsgID),
}
default:
log.Warn().Type("reply_to", replyTo).Msg("unhandled reply to type")
@@ -415,8 +415,8 @@ func (c *TelegramClient) convertContact(media tg.MessageMediaClass) *bridgev2.Co
if contact.UserID > 0 {
content.Format = event.FormatHTML
content.FormattedBody = fmt.Sprintf(
`Shared contact info for <a href="https://matrix.to/#/%s">%s</a>: %s`,
c.main.Bridge.Matrix.GhostIntent(ids.MakeUserID(contact.UserID)).GetMXID(),
`Shared contact info for <a href="%s">%s</a>: %s`,
c.main.Bridge.Matrix.GhostIntent(ids.MakeUserID(contact.UserID)).GetMXID().URI().MatrixToURL(),
html.EscapeString(name),
html.EscapeString(formattedPhone),
)