Function
onThreadMessage
(
threadId: string,
message: SerializedMessage,
messageId: string,
imitationId: string
)
Source from the content-addressed store, hash-verified
| 53 | const currentUser = permissions.user; |
| 54 | |
| 55 | const onThreadMessage = ( |
| 56 | threadId: string, |
| 57 | message: SerializedMessage, |
| 58 | messageId: string, |
| 59 | imitationId: string |
| 60 | ) => { |
| 61 | setThread((thread: SerializedThread) => { |
| 62 | if (thread.id === threadId) { |
| 63 | return { |
| 64 | ...thread, |
| 65 | messages: [ |
| 66 | ...thread.messages.filter( |
| 67 | ({ id }: any) => id !== imitationId && id !== messageId |
| 68 | ), |
| 69 | message, |
| 70 | ], |
| 71 | }; |
| 72 | } |
| 73 | return thread; |
| 74 | }); |
| 75 | }; |
| 76 | |
| 77 | const updateThread = ({ |
| 78 | state: newState, |
Tested by
no test coverage detected