media: bridge GIFs as documents rather than images
This allows them to be animated. Closes PLAT-25990 Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -49,7 +49,7 @@ func (t *TelegramClient) transferMediaToTelegram(ctx context.Context, content *e
|
||||
return nil, fmt.Errorf("failed to upload media to Telegram: %w", err)
|
||||
}
|
||||
|
||||
if content.MsgType == event.MsgImage {
|
||||
if content.MsgType == event.MsgImage && (content.Info.MimeType == "image/jpeg" || content.Info.MimeType == "image/png") {
|
||||
return &tg.InputMediaUploadedPhoto{File: upload}, nil
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func (t *TelegramClient) HandleMatrixMessage(ctx context.Context, msg *bridgev2.
|
||||
|
||||
var updates tg.UpdatesClass
|
||||
switch msg.Content.MsgType {
|
||||
case event.MsgText, event.MsgNotice:
|
||||
case event.MsgText, event.MsgNotice, event.MsgEmote:
|
||||
updates, err = t.client.API().MessagesSendMessage(ctx, &tg.MessagesSendMessageRequest{
|
||||
Peer: peer,
|
||||
NoWebpage: noWebpage,
|
||||
|
||||
@@ -82,7 +82,7 @@ func toTelegramEntity(br telegramfmt.BodyRange) tg.MessageEntityClass {
|
||||
}
|
||||
|
||||
func Parse(ctx context.Context, parser *HTMLParser, content *event.MessageEventContent) (string, []tg.MessageEntityClass) {
|
||||
if content.MsgType.IsMedia() && content.FileName == "" {
|
||||
if content.MsgType.IsMedia() && (content.FileName == "" || content.FileName == content.Body) {
|
||||
// The body is the filename.
|
||||
return "", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user