MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / editMessage

Function editMessage

apps/web/ui/ChannelView/index.tsx:685–723  ·  view source on GitHub ↗
({
    id: messageId,
    body,
  }: {
    id: string;
    body: string;
  })

Source from the content-addressed store, hash-verified

683 };
684
685 const editMessage = async ({
686 id: messageId,
687 body,
688 }: {
689 id: string;
690 body: string;
691 }) => {
692 setThreads((threads) => {
693 return threads.map((thread) => {
694 const message = thread.messages.find(
695 ({ id }: SerializedMessage) => id === messageId
696 );
697 if (message) {
698 return {
699 ...thread,
700 messages: thread.messages.map((message: SerializedMessage) => {
701 if (message.id === messageId) {
702 return {
703 ...message,
704 body,
705 };
706 }
707 return message;
708 }),
709 };
710 }
711 return thread;
712 });
713 });
714 return api
715 .updateMessage({
716 accountId: settings.communityId,
717 id: messageId,
718 body,
719 })
720 .catch((_) => {
721 Toast.error('Failed to edit the message.');
722 });
723 };
724
725 function onThreadMessage(
726 threadId: string,

Callers

nothing calls this directly

Calls 4

mapMethod · 0.80
updateMessageMethod · 0.80
errorMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected