push: only send direct notifications if we have data (#133)
This commit is contained in:
committed by
GitHub
parent
ae5f2f3093
commit
bec7ee8f5e
@@ -262,7 +262,7 @@ func (t *TelegramClient) ConnectBackground(ctx context.Context, params *bridgev2
|
|||||||
var sender *bridgev2.Ghost
|
var sender *bridgev2.Ghost
|
||||||
var messageID networkid.MessageID
|
var messageID networkid.MessageID
|
||||||
var messageText, notificationText, notificationTitle string
|
var messageText, notificationText, notificationTitle string
|
||||||
if data != nil {
|
if notifs, ok := t.main.Bridge.Matrix.(bridgev2.MatrixConnectorWithNotifications); ok && data != nil {
|
||||||
if data.Aps != nil {
|
if data.Aps != nil {
|
||||||
notificationTitle = data.Aps.Alert.Title
|
notificationTitle = data.Aps.Alert.Title
|
||||||
notificationText = data.Aps.Alert.Body
|
notificationText = data.Aps.Alert.Body
|
||||||
@@ -306,9 +306,6 @@ func (t *TelegramClient) ConnectBackground(ctx context.Context, params *bridgev2
|
|||||||
if relatedPortal != nil && data.Custom.MessageID != 0 {
|
if relatedPortal != nil && data.Custom.MessageID != 0 {
|
||||||
messageID = ids.MakeMessageID(relatedPortal.PortalKey, data.Custom.MessageID)
|
messageID = ids.MakeMessageID(relatedPortal.PortalKey, data.Custom.MessageID)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
notifs, ok := t.main.Bridge.Matrix.(bridgev2.MatrixConnectorWithNotifications)
|
|
||||||
if ok {
|
|
||||||
notifs.DisplayNotification(ctx, &bridgev2.DirectNotificationData{
|
notifs.DisplayNotification(ctx, &bridgev2.DirectNotificationData{
|
||||||
Portal: relatedPortal,
|
Portal: relatedPortal,
|
||||||
Sender: sender,
|
Sender: sender,
|
||||||
|
|||||||
Reference in New Issue
Block a user