Skip to content

Commit f7fa9fe

Browse files
msgconv: fix view once placeholder copy when you send instead of receive (#848)
Co-authored-by: Rajeh Taher <[email protected]>
1 parent 6fbd345 commit f7fa9fe

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/connector/events.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,13 @@ func (evt *WAUndecryptableMessage) ConvertMessage(ctx context.Context, portal *b
340340
}
341341
content := &undecryptableMessageContent
342342
if evt.Type == events.UnavailableTypeViewOnce {
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."
346+
}
343347
content = &event.MessageEventContent{
344348
MsgType: event.MsgNotice,
345-
Body: "You received a view once message. For added privacy, you can only open it on the WhatsApp app.",
349+
Body: body,
346350
}
347351
}
348352
// TODO thread root for comments

pkg/msgconv/wa-media.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ func (mc *MessageConverter) convertMediaMessage(
5454
cachedPart *bridgev2.ConvertedMessagePart,
5555
) (part *bridgev2.ConvertedMessagePart, contextInfo *waE2E.ContextInfo) {
5656
if mc.DisableViewOnce && isViewOnce {
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."
60+
}
5761
return &bridgev2.ConvertedMessagePart{
5862
Type: event.EventMessage,
5963
Content: &event.MessageEventContent{
6064
MsgType: event.MsgNotice,
61-
Body: fmt.Sprintf("You received a view once %s. For added privacy, you can only open it on the WhatsApp app.", typeName),
65+
Body: body,
6266
},
6367
}, nil
6468
}

0 commit comments

Comments
 (0)