Telegram: add the possibility to disable buttons

Closes #2093
This commit is contained in:
Jany 2023-09-28 03:02:22 +00:00 committed by GitHub
parent c0e954f19d
commit e0e8a99abe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 85 additions and 44 deletions

View file

@ -776,4 +776,11 @@ var migrations = []func(tx *sql.Tx) error{
_, err = tx.Exec(sql) _, err = tx.Exec(sql)
return err return err
}, },
func(tx *sql.Tx) (err error) {
sql := `
ALTER TABLE integrations ADD COLUMN telegram_bot_disable_buttons bool default 'f';
`
_, err = tx.Exec(sql)
return err
},
} }

View file

@ -354,6 +354,7 @@ func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *mode
userIntegrations.TelegramBotTopicID, userIntegrations.TelegramBotTopicID,
userIntegrations.TelegramBotDisableWebPagePreview, userIntegrations.TelegramBotDisableWebPagePreview,
userIntegrations.TelegramBotDisableNotification, userIntegrations.TelegramBotDisableNotification,
userIntegrations.TelegramBotDisableButtons,
); err != nil { ); err != nil {
slog.Error("Unable to send entry to Telegram", slog.Error("Unable to send entry to Telegram",
slog.Int64("user_id", userIntegrations.UserID), slog.Int64("user_id", userIntegrations.UserID),

View file

@ -9,7 +9,7 @@ import (
"miniflux.app/v2/internal/model" "miniflux.app/v2/internal/model"
) )
func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool) error { func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool, disableButtons bool) error {
textTemplate := `<b><a href=%q>%s</a></b> - <a href=%q>%s</a>` textTemplate := `<b><a href=%q>%s</a></b> - <a href=%q>%s</a>`
formattedText := fmt.Sprintf( formattedText := fmt.Sprintf(
textTemplate, textTemplate,
@ -31,19 +31,21 @@ func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, to
message.MessageThreadID = *topicID message.MessageThreadID = *topicID
} }
var markupRow []*InlineKeyboardButton if !disableButtons {
var markupRow []*InlineKeyboardButton
minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL}
markupRow = append(markupRow, &minifluxURLButton) markupRow = append(markupRow, &minifluxURLButton)
if entry.CommentsURL != "" { if entry.CommentsURL != "" {
commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL}
markupRow = append(markupRow, &commentButton) markupRow = append(markupRow, &commentButton)
}
message.ReplyMarkup = &InlineKeyboard{}
message.ReplyMarkup.InlineKeyboard = append(message.ReplyMarkup.InlineKeyboard, markupRow)
} }
message.ReplyMarkup = &InlineKeyboard{}
message.ReplyMarkup.InlineKeyboard = append(message.ReplyMarkup.InlineKeyboard, markupRow)
client := NewClient(botToken, chatID) client := NewClient(botToken, chatID)
_, err := client.SendMessage(message) _, err := client.SendMessage(message)
return err return err

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Artikel in Linkding speichern", "form.integration.linkding_activate": "Artikel in Linkding speichern",
"form.integration.linkding_endpoint": "Linkding API-Endpunkt", "form.integration.linkding_endpoint": "Linkding API-Endpunkt",
"form.integration.linkding_api_key": "Linkding API-Schlüssel", "form.integration.linkding_api_key": "Linkding API-Schlüssel",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Αποθήκευση άρθρων στο Linkding", "form.integration.linkding_activate": "Αποθήκευση άρθρων στο Linkding",
"form.integration.linkding_endpoint": "Τελικό σημείο Linkding API", "form.integration.linkding_endpoint": "Τελικό σημείο Linkding API",
"form.integration.linkding_api_key": "Κλειδί API Linkding", "form.integration.linkding_api_key": "Κλειδί API Linkding",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Save entries to Linkding", "form.integration.linkding_activate": "Save entries to Linkding",
"form.integration.linkding_endpoint": "Linkding API Endpoint", "form.integration.linkding_endpoint": "Linkding API Endpoint",
"form.integration.linkding_api_key": "Linkding API key", "form.integration.linkding_api_key": "Linkding API key",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Enviar artículos a Linkding", "form.integration.linkding_activate": "Enviar artículos a Linkding",
"form.integration.linkding_endpoint": "Acceso API de Linkding", "form.integration.linkding_endpoint": "Acceso API de Linkding",
"form.integration.linkding_api_key": "Clave de API de Linkding", "form.integration.linkding_api_key": "Clave de API de Linkding",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Tallenna artikkelit Linkkiin", "form.integration.linkding_activate": "Tallenna artikkelit Linkkiin",
"form.integration.linkding_endpoint": "Linkding API-päätepiste", "form.integration.linkding_endpoint": "Linkding API-päätepiste",
"form.integration.linkding_api_key": "Linkding API-avain", "form.integration.linkding_api_key": "Linkding API-avain",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Identifiant du sujet (Topic ID)", "form.integration.telegram_topic_id": "Identifiant du sujet (Topic ID)",
"form.integration.telegram_bot_disable_web_page_preview": "Désactiver l'aperçu de la page Web", "form.integration.telegram_bot_disable_web_page_preview": "Désactiver l'aperçu de la page Web",
"form.integration.telegram_bot_disable_notification": "Désactiver les notifications", "form.integration.telegram_bot_disable_notification": "Désactiver les notifications",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Sauvegarder les articles vers Linkding", "form.integration.linkding_activate": "Sauvegarder les articles vers Linkding",
"form.integration.linkding_endpoint": "URL de l'API de Linkding", "form.integration.linkding_endpoint": "URL de l'API de Linkding",
"form.integration.linkding_api_key": "Clé d'API de Linkding", "form.integration.linkding_api_key": "Clé d'API de Linkding",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "लिंक्डिन में विषयवस्तु सहेजें", "form.integration.linkding_activate": "लिंक्डिन में विषयवस्तु सहेजें",
"form.integration.linkding_endpoint": "लिंकिंग एपीआई समापन बिंदु", "form.integration.linkding_endpoint": "लिंकिंग एपीआई समापन बिंदु",
"form.integration.linkding_api_key": "लिंकिंग एपीआई कुंजी", "form.integration.linkding_api_key": "लिंकिंग एपीआई कुंजी",

View file

@ -379,6 +379,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Simpan artikel ke Linkding", "form.integration.linkding_activate": "Simpan artikel ke Linkding",
"form.integration.linkding_endpoint": "Titik URL API Linkding", "form.integration.linkding_endpoint": "Titik URL API Linkding",
"form.integration.linkding_api_key": "Kunci API Linkding", "form.integration.linkding_api_key": "Kunci API Linkding",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Salva gli articoli su Linkding", "form.integration.linkding_activate": "Salva gli articoli su Linkding",
"form.integration.linkding_endpoint": "Endpoint dell'API di Linkding", "form.integration.linkding_endpoint": "Endpoint dell'API di Linkding",
"form.integration.linkding_api_key": "API key dell'account Linkding", "form.integration.linkding_api_key": "API key dell'account Linkding",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Linkding に記事を保存する", "form.integration.linkding_activate": "Linkding に記事を保存する",
"form.integration.linkding_endpoint": "Linkding の API Endpoint", "form.integration.linkding_endpoint": "Linkding の API Endpoint",
"form.integration.linkding_api_key": "Linkding の API key", "form.integration.linkding_api_key": "Linkding の API key",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Opslaan naar Linkding", "form.integration.linkding_activate": "Opslaan naar Linkding",
"form.integration.linkding_endpoint": "Linkding URL", "form.integration.linkding_endpoint": "Linkding URL",
"form.integration.linkding_api_key": "Linkding API-sleutel", "form.integration.linkding_api_key": "Linkding API-sleutel",

View file

@ -384,6 +384,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Zapisz artykuły do Linkding", "form.integration.linkding_activate": "Zapisz artykuły do Linkding",
"form.integration.linkding_endpoint": "Linkding URL", "form.integration.linkding_endpoint": "Linkding URL",
"form.integration.linkding_api_key": "Linkding API key", "form.integration.linkding_api_key": "Linkding API key",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Salvar itens no Linkding", "form.integration.linkding_activate": "Salvar itens no Linkding",
"form.integration.linkding_endpoint": "Endpoint de API do Linkding", "form.integration.linkding_endpoint": "Endpoint de API do Linkding",
"form.integration.linkding_api_key": "Chave de API do Linkding", "form.integration.linkding_api_key": "Chave de API do Linkding",

View file

@ -384,6 +384,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Сохранять статьи в Linkding", "form.integration.linkding_activate": "Сохранять статьи в Linkding",
"form.integration.linkding_endpoint": "Конечная точка Linkding API", "form.integration.linkding_endpoint": "Конечная точка Linkding API",
"form.integration.linkding_api_key": "API-ключ Linkding", "form.integration.linkding_api_key": "API-ключ Linkding",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "Makaleleri Linkding'e kaydet", "form.integration.linkding_activate": "Makaleleri Linkding'e kaydet",
"form.integration.linkding_endpoint": "Linkding API Uç Noktası", "form.integration.linkding_endpoint": "Linkding API Uç Noktası",
"form.integration.linkding_api_key": "Linkding API Anahtarı", "form.integration.linkding_api_key": "Linkding API Anahtarı",

View file

@ -384,6 +384,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.telegram_chat_id": "ID чату", "form.integration.telegram_chat_id": "ID чату",
"form.integration.linkding_activate": "Зберігати статті до Linkding", "form.integration.linkding_activate": "Зберігати статті до Linkding",
"form.integration.linkding_endpoint": "Linkding API Endpoint", "form.integration.linkding_endpoint": "Linkding API Endpoint",
@ -441,4 +442,4 @@
"%d роки тому", "%d роки тому",
"%d років тому" "%d років тому"
] ]
} }

View file

@ -379,6 +379,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.telegram_chat_id": "聊天ID", "form.integration.telegram_chat_id": "聊天ID",
"form.integration.linkding_activate": "保存文章到 Linkding", "form.integration.linkding_activate": "保存文章到 Linkding",
"form.integration.linkding_endpoint": "Linkding API 端点", "form.integration.linkding_endpoint": "Linkding API 端点",

View file

@ -382,6 +382,7 @@
"form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_topic_id": "Topic ID",
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkding_activate": "儲存文章到 Linkding", "form.integration.linkding_activate": "儲存文章到 Linkding",
"form.integration.linkding_endpoint": "Linkding API 端點", "form.integration.linkding_endpoint": "Linkding API 端點",
"form.integration.linkding_api_key": "Linkding API 金鑰", "form.integration.linkding_api_key": "Linkding API 金鑰",

View file

@ -47,6 +47,7 @@ type Integration struct {
TelegramBotTopicID *int64 TelegramBotTopicID *int64
TelegramBotDisableWebPagePreview bool TelegramBotDisableWebPagePreview bool
TelegramBotDisableNotification bool TelegramBotDisableNotification bool
TelegramBotDisableButtons bool
LinkdingEnabled bool LinkdingEnabled bool
LinkdingURL string LinkdingURL string
LinkdingAPIKey string LinkdingAPIKey string

View file

@ -151,6 +151,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
telegram_bot_topic_id, telegram_bot_topic_id,
telegram_bot_disable_web_page_preview, telegram_bot_disable_web_page_preview,
telegram_bot_disable_notification, telegram_bot_disable_notification,
telegram_bot_disable_buttons,
linkding_enabled, linkding_enabled,
linkding_url, linkding_url,
linkding_api_key, linkding_api_key,
@ -223,6 +224,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
&integration.TelegramBotTopicID, &integration.TelegramBotTopicID,
&integration.TelegramBotDisableWebPagePreview, &integration.TelegramBotDisableWebPagePreview,
&integration.TelegramBotDisableNotification, &integration.TelegramBotDisableNotification,
&integration.TelegramBotDisableButtons,
&integration.LinkdingEnabled, &integration.LinkdingEnabled,
&integration.LinkdingURL, &integration.LinkdingURL,
&integration.LinkdingAPIKey, &integration.LinkdingAPIKey,
@ -295,40 +297,41 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
telegram_bot_topic_id=$30, telegram_bot_topic_id=$30,
telegram_bot_disable_web_page_preview=$31, telegram_bot_disable_web_page_preview=$31,
telegram_bot_disable_notification=$32, telegram_bot_disable_notification=$32,
espial_enabled=$33, telegram_bot_disable_buttons=$33,
espial_url=$34, espial_enabled=$34,
espial_api_key=$35, espial_url=$35,
espial_tags=$36, espial_api_key=$36,
linkding_enabled=$37, espial_tags=$37,
linkding_url=$38, linkding_enabled=$38,
linkding_api_key=$39, linkding_url=$39,
linkding_tags=$40, linkding_api_key=$40,
linkding_mark_as_unread=$41, linkding_tags=$41,
matrix_bot_enabled=$42, linkding_mark_as_unread=$42,
matrix_bot_user=$43, matrix_bot_enabled=$43,
matrix_bot_password=$44, matrix_bot_user=$44,
matrix_bot_url=$45, matrix_bot_password=$45,
matrix_bot_chat_id=$46, matrix_bot_url=$46,
notion_enabled=$47, matrix_bot_chat_id=$47,
notion_token=$48, notion_enabled=$48,
notion_page_id=$49, notion_token=$49,
readwise_enabled=$50, notion_page_id=$50,
readwise_api_key=$51, readwise_enabled=$51,
apprise_enabled=$52, readwise_api_key=$52,
apprise_url=$53, apprise_enabled=$53,
apprise_services_url=$54, apprise_url=$54,
shiori_enabled=$55, apprise_services_url=$55,
shiori_url=$56, shiori_enabled=$56,
shiori_username=$57, shiori_url=$57,
shiori_password=$58, shiori_username=$58,
shaarli_enabled=$59, shiori_password=$59,
shaarli_url=$60, shaarli_enabled=$60,
shaarli_api_secret=$61, shaarli_url=$61,
webhook_enabled=$62, shaarli_api_secret=$62,
webhook_url=$63, webhook_enabled=$63,
webhook_secret=$64 webhook_url=$64,
webhook_secret=$65
WHERE WHERE
user_id=$65 user_id=$66
` `
_, err := s.db.Exec( _, err := s.db.Exec(
query, query,
@ -364,6 +367,7 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
integration.TelegramBotTopicID, integration.TelegramBotTopicID,
integration.TelegramBotDisableWebPagePreview, integration.TelegramBotDisableWebPagePreview,
integration.TelegramBotDisableNotification, integration.TelegramBotDisableNotification,
integration.TelegramBotDisableButtons,
integration.EspialEnabled, integration.EspialEnabled,
integration.EspialURL, integration.EspialURL,
integration.EspialAPIKey, integration.EspialAPIKey,

View file

@ -339,6 +339,10 @@
<input type="checkbox" name="telegram_bot_disable_notification" value="1" {{ if .form.TelegramBotDisableNotification }}checked{{ end }}> {{ t "form.integration.telegram_bot_disable_notification" }} <input type="checkbox" name="telegram_bot_disable_notification" value="1" {{ if .form.TelegramBotDisableNotification }}checked{{ end }}> {{ t "form.integration.telegram_bot_disable_notification" }}
</label> </label>
<label>
<input type="checkbox" name="telegram_bot_disable_buttons" value="1" {{ if .form.TelegramBotDisableButtons }}checked{{ end }}> {{ t "form.integration.telegram_bot_disable_buttons" }}
</label>
<div class="buttons"> <div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button> <button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
</div> </div>

View file

@ -53,6 +53,7 @@ type IntegrationForm struct {
TelegramBotTopicID *int64 TelegramBotTopicID *int64
TelegramBotDisableWebPagePreview bool TelegramBotDisableWebPagePreview bool
TelegramBotDisableNotification bool TelegramBotDisableNotification bool
TelegramBotDisableButtons bool
LinkdingEnabled bool LinkdingEnabled bool
LinkdingURL string LinkdingURL string
LinkdingAPIKey string LinkdingAPIKey string
@ -119,6 +120,7 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
integration.TelegramBotTopicID = i.TelegramBotTopicID integration.TelegramBotTopicID = i.TelegramBotTopicID
integration.TelegramBotDisableWebPagePreview = i.TelegramBotDisableWebPagePreview integration.TelegramBotDisableWebPagePreview = i.TelegramBotDisableWebPagePreview
integration.TelegramBotDisableNotification = i.TelegramBotDisableNotification integration.TelegramBotDisableNotification = i.TelegramBotDisableNotification
integration.TelegramBotDisableButtons = i.TelegramBotDisableButtons
integration.LinkdingEnabled = i.LinkdingEnabled integration.LinkdingEnabled = i.LinkdingEnabled
integration.LinkdingURL = i.LinkdingURL integration.LinkdingURL = i.LinkdingURL
integration.LinkdingAPIKey = i.LinkdingAPIKey integration.LinkdingAPIKey = i.LinkdingAPIKey
@ -187,6 +189,7 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
TelegramBotTopicID: optionalInt64Field(r.FormValue("telegram_bot_topic_id")), TelegramBotTopicID: optionalInt64Field(r.FormValue("telegram_bot_topic_id")),
TelegramBotDisableWebPagePreview: r.FormValue("telegram_bot_disable_web_page_preview") == "1", TelegramBotDisableWebPagePreview: r.FormValue("telegram_bot_disable_web_page_preview") == "1",
TelegramBotDisableNotification: r.FormValue("telegram_bot_disable_notification") == "1", TelegramBotDisableNotification: r.FormValue("telegram_bot_disable_notification") == "1",
TelegramBotDisableButtons: r.FormValue("telegram_bot_disable_buttons") == "1",
LinkdingEnabled: r.FormValue("linkding_enabled") == "1", LinkdingEnabled: r.FormValue("linkding_enabled") == "1",
LinkdingURL: r.FormValue("linkding_url"), LinkdingURL: r.FormValue("linkding_url"),
LinkdingAPIKey: r.FormValue("linkding_api_key"), LinkdingAPIKey: r.FormValue("linkding_api_key"),

View file

@ -67,6 +67,7 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
TelegramBotTopicID: integration.TelegramBotTopicID, TelegramBotTopicID: integration.TelegramBotTopicID,
TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview, TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview,
TelegramBotDisableNotification: integration.TelegramBotDisableNotification, TelegramBotDisableNotification: integration.TelegramBotDisableNotification,
TelegramBotDisableButtons: integration.TelegramBotDisableButtons,
LinkdingEnabled: integration.LinkdingEnabled, LinkdingEnabled: integration.LinkdingEnabled,
LinkdingURL: integration.LinkdingURL, LinkdingURL: integration.LinkdingURL,
LinkdingAPIKey: integration.LinkdingAPIKey, LinkdingAPIKey: integration.LinkdingAPIKey,