Skip to content

Commit

Permalink
use msgId when editing threads
Browse files Browse the repository at this point in the history
  • Loading branch information
raykyri committed Aug 2, 2024
1 parent 7ad381e commit 74738f9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ const editThread = async ({
// for editing thread collaborators
collaborators,
}: EditThreadProps): Promise<Thread> => {
const canvasSignedData = await signUpdateThread(address, {
thread_id: threadMsgId,
title: newTitle,
body: newBody,
link: url,
topic: topicId,
});
let canvasSignedData;
if (newBody || newTitle) {
canvasSignedData = await signUpdateThread(address, {
thread_id: threadMsgId,
title: newTitle,
body: newBody,
link: url,
topic: topicId,
});
}

const response = await axios.patch(`${app.serverUrl()}/threads/${threadId}`, {
// common payload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const ChangeThreadTopicModal = ({
await editThread({
communityId: app.activeChainId(),
address: user.activeAccount?.address || '',
threadMsgId: thread.canvasMsgId,
threadId: thread.id,
topicId: activeTopic.id,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const EditCollaboratorsModal = ({
const { mutateAsync: editThread } = useEditThreadMutation({
communityId: app.activeChainId(),
threadId: thread.id,
threadMsgId: thread.canvasMsgId,
currentStage: thread.stage,
currentTopicId: thread.topic.id,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const AdminActions = ({
const { mutateAsync: editThread } = useEditThreadMutation({
communityId: app.activeChainId(),
threadId: thread.id,
threadMsgId: thread.canvasMsgId,
currentStage: thread.stage,
currentTopicId: thread.topic?.id,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const EditBody = (props: EditBodyProps) => {
newBody: JSON.stringify(contentDelta) || thread.body,
newTitle: title || thread.title,
threadId: thread.id,
threadMsgId: thread.canvasMsgId,
authorProfile: user.activeAccount?.profile,
address: user.activeAccount?.address || '',
communityId: app.activeChainId(),
Expand Down

0 comments on commit 74738f9

Please sign in to comment.