@@ -845,18 +845,7 @@ export async function attachWebInboxToSocket(
|
845 | 845 | } |
846 | 846 | }; |
847 | 847 | |
848 | | -const maybeMarkReadReceiptAfterCompletedDelivery = async ( |
849 | | -inbound: NormalizedInboundMessage, |
850 | | -target: WhatsAppReadReceiptTarget | undefined, |
851 | | -) => { |
852 | | -if (inbound.access.isSelfChat) { |
853 | | -maybeLogSkippedSelfChatReadReceipt(inbound, target); |
854 | | -return; |
855 | | -} |
856 | | -await maybeMarkInboundAsRead(target); |
857 | | -}; |
858 | | - |
859 | | -const maybeMarkReadReceiptForSkippedAppend = async ( |
| 848 | +const maybeMarkNonSelfChatReadReceipt = async ( |
860 | 849 | inbound: NormalizedInboundMessage, |
861 | 850 | target: WhatsAppReadReceiptTarget | undefined, |
862 | 851 | ) => { |
@@ -921,7 +910,7 @@ export async function attachWebInboxToSocket(
|
921 | 910 | const deliveryReadReceipt = inbound.access.isSelfChat ? undefined : readReceipt; |
922 | 911 | |
923 | 912 | if (!stored && shouldSkipStaleAppend(msg, upsertType)) { |
924 | | -await maybeMarkReadReceiptForSkippedAppend(inbound, readReceipt); |
| 913 | +await maybeMarkNonSelfChatReadReceipt(inbound, readReceipt); |
925 | 914 | return; |
926 | 915 | } |
927 | 916 | |
@@ -948,7 +937,7 @@ export async function attachWebInboxToSocket(
|
948 | 937 | }, |
949 | 938 | ); |
950 | 939 | if (accepted.kind === "completed") { |
951 | | -await maybeMarkReadReceiptAfterCompletedDelivery( |
| 940 | +await maybeMarkNonSelfChatReadReceipt( |
952 | 941 | inbound, |
953 | 942 | accepted.record.metadata?.readReceipt ?? deliveryReadReceipt, |
954 | 943 | ); |
@@ -973,7 +962,7 @@ export async function attachWebInboxToSocket(
|
973 | 962 | const enriched = await enrichInboundMessage(msg); |
974 | 963 | if (!enriched) { |
975 | 964 | await completeUndeliverableDurableInbound(durableId, durableMetadata); |
976 | | -await maybeMarkReadReceiptAfterCompletedDelivery(inbound, deliveryReadReceipt); |
| 965 | +await maybeMarkNonSelfChatReadReceipt(inbound, deliveryReadReceipt); |
977 | 966 | return; |
978 | 967 | } |
979 | 968 | |
@@ -982,7 +971,7 @@ export async function attachWebInboxToSocket(
|
982 | 971 | if (dedupeClaim !== "claimed") { |
983 | 972 | if (dedupeClaim === "duplicate") { |
984 | 973 | await completeUndeliverableDurableInbound(durableId, durableMetadata); |
985 | | -await maybeMarkReadReceiptAfterCompletedDelivery(inbound, deliveryReadReceipt); |
| 974 | +await maybeMarkNonSelfChatReadReceipt(inbound, deliveryReadReceipt); |
986 | 975 | } |
987 | 976 | return; |
988 | 977 | } |
|