From d7f5ee8415bd6d37a889d395f30b912cb1068e09 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Fri, 10 Jan 2025 23:35:21 +0000
Subject: Conversation-level reporting by reporting most recent message
 available (#7423)

* report latest message via convo menu

* check all messages we have

* fix types

* rm convo warning
---
 src/components/dms/MessagesListHeader.tsx | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/components/dms/MessagesListHeader.tsx')

diff --git a/src/components/dms/MessagesListHeader.tsx b/src/components/dms/MessagesListHeader.tsx
index acffa0c2b..6ac64a712 100644
--- a/src/components/dms/MessagesListHeader.tsx
+++ b/src/components/dms/MessagesListHeader.tsx
@@ -151,6 +151,15 @@ function HeaderReady({
         moderation.ui('displayName'),
       )
 
+  const latestMessageFromOther = convoState.items.findLast(
+    item => item.type === 'message' && item.message.sender.did === profile.did,
+  )
+
+  const latestReportableMessage =
+    latestMessageFromOther?.type === 'message'
+      ? latestMessageFromOther.message
+      : undefined
+
   return (
     <View style={[a.flex_1]}>
       <View style={[a.w_full, a.flex_row, a.align_center, a.justify_between]}>
@@ -208,6 +217,7 @@ function HeaderReady({
             profile={profile}
             currentScreen="conversation"
             blockInfo={blockInfo}
+            latestReportableMessage={latestReportableMessage}
           />
         )}
       </View>
-- 
cgit 1.4.1

