Skip to content

Commit f59227b

Browse files
committed
Simplify further
1 parent dc426fb commit f59227b

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

pkg/connector/events.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,10 @@ func (evt *WAUndecryptableMessage) ConvertMessage(ctx context.Context, portal *b
340340
}
341341
content := &undecryptableMessageContent
342342
if evt.Type == events.UnavailableTypeViewOnce {
343-
verb := "sent"
344-
suffix := ""
345-
if !evt.Info.IsFromMe {
346-
verb = "received"
347-
suffix = " For added privacy, you can only open it on the WhatsApp app."
343+
body := "You received a view once message. For added privacy, you can only open it on the WhatsApp app."
344+
if evt.Info.IsFromMe {
345+
body = "You sent a view once message from another device."
348346
}
349-
body := fmt.Sprintf("You %s a view once message.%s", verb, suffix)
350347
content = &event.MessageEventContent{
351348
MsgType: event.MsgNotice,
352349
Body: body,

pkg/msgconv/wa-media.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ func (mc *MessageConverter) convertMediaMessage(
5454
cachedPart *bridgev2.ConvertedMessagePart,
5555
) (part *bridgev2.ConvertedMessagePart, contextInfo *waE2E.ContextInfo) {
5656
if mc.DisableViewOnce && isViewOnce {
57-
verb := "sent"
58-
suffix := ""
59-
if !messageInfo.IsFromMe {
60-
verb = "received"
61-
suffix = " For added privacy, you can only open it on the WhatsApp app."
57+
body := "You received a view once message. For added privacy, you can only open it on the WhatsApp app."
58+
if messageInfo.IsFromMe {
59+
body = "You sent a view once message from another device."
6260
}
63-
body := fmt.Sprintf("You %s a view once %s.%s", verb, typeName, suffix)
6461
return &bridgev2.ConvertedMessagePart{
6562
Type: event.EventMessage,
6663
Content: &event.MessageEventContent{

0 commit comments

Comments
 (0)