From 16b1f5d0c91c81447de6515c4fe5877985dbf9be Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 21 Aug 2023 11:09:36 +0300 Subject: [PATCH] Ignore link preview tombstones in groups as well --- portal.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/portal.go b/portal.go index 883682a..91121e2 100644 --- a/portal.go +++ b/portal.go @@ -791,7 +791,7 @@ func addDownloadStatus(content *event.MessageEventContent, status string) { } } -func shouldIgnoreStatus(status gmproto.MessageStatusType) bool { +func (portal *Portal) shouldIgnoreStatus(status gmproto.MessageStatusType) bool { switch status { case gmproto.MessageStatusType_TOMBSTONE_PROTOCOL_SWITCH_TO_TEXT, gmproto.MessageStatusType_TOMBSTONE_PROTOCOL_SWITCH_TO_RCS, @@ -800,8 +800,9 @@ func shouldIgnoreStatus(status gmproto.MessageStatusType) bool { gmproto.MessageStatusType_MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_TEXT_TO_E2EE, gmproto.MessageStatusType_MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_E2EE_TO_TEXT, gmproto.MessageStatusType_MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_RCS_TO_E2EE, - gmproto.MessageStatusType_MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_E2EE_TO_RCS, - gmproto.MessageStatusType_TOMBSTONE_SHOW_LINK_PREVIEWS: + gmproto.MessageStatusType_MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_E2EE_TO_RCS: + return portal.IsPrivateChat() + case gmproto.MessageStatusType_TOMBSTONE_SHOW_LINK_PREVIEWS: return true default: return false @@ -817,7 +818,7 @@ func (portal *Portal) convertGoogleMessage(ctx context.Context, source *User, ev cm.ID = evt.MessageID cm.PartCount = len(evt.GetMessageInfo()) cm.Timestamp = time.UnixMicro(evt.Timestamp) - cm.DontBridge = portal.IsPrivateChat() && shouldIgnoreStatus(cm.Status) + cm.DontBridge = portal.shouldIgnoreStatus(cm.Status) if cm.Status >= 200 && cm.Status < 300 { cm.Intent = portal.bridge.Bot if !portal.Encrypted && portal.IsPrivateChat() {