From 39d752ca85d0f590684af76f53eedbdc53f81801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Wed, 27 Sep 2023 20:20:09 -0700 Subject: [PATCH] Telegram: replace feed HTML link with a button to avoid page preview issues --- internal/integration/telegrambot/telegrambot.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/integration/telegrambot/telegrambot.go b/internal/integration/telegrambot/telegrambot.go index b73b78ae..d63ef560 100644 --- a/internal/integration/telegrambot/telegrambot.go +++ b/internal/integration/telegrambot/telegrambot.go @@ -10,11 +10,8 @@ import ( ) func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool, disableButtons bool) error { - textTemplate := `%s - %s` formattedText := fmt.Sprintf( - textTemplate, - feed.SiteURL, - feed.Title, + `%s`, entry.URL, entry.Title, ) @@ -34,12 +31,15 @@ func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, to if !disableButtons { var markupRow []*InlineKeyboardButton - minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} - markupRow = append(markupRow, &minifluxURLButton) + websiteURLButton := InlineKeyboardButton{Text: "Go to website", URL: feed.SiteURL} + markupRow = append(markupRow, &websiteURLButton) + + articleURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} + markupRow = append(markupRow, &articleURLButton) if entry.CommentsURL != "" { - commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} - markupRow = append(markupRow, &commentButton) + commentURLButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} + markupRow = append(markupRow, &commentURLButton) } message.ReplyMarkup = &InlineKeyboard{}