more webapp conversation refactor

This commit is contained in:
Roland Osborne 2023-01-25 23:59:19 -08:00
parent 3ceea69f99
commit d0ee4a7515
4 changed files with 8 additions and 5 deletions

View File

@ -284,7 +284,8 @@ export function useCardContext() {
let node = cardProfile.node;
if (files?.length) {
const topicId = await addContactChannelTopic(node, token, channelId, null, null, null);
upload.actions.addContactTopic(node, token, cardId, channelId, topicId, files, async (assets) => {
const contact = { server: node, cardId };
upload.actions.addTopic(token, channelId, topicId, files, async (assets) => {
const subject = message(assets);
await setContactChannelTopicSubject(node, token, channelId, topicId, type, subject);
}, async () => {
@ -294,7 +295,7 @@ export function useCardContext() {
catch(err) {
console.log(err);
}
});
}, contact);
}
else {
const subject = message([]);

View File

@ -59,12 +59,13 @@ export function useUploadContext() {
const actions = {
addTopic: (token, channelId, topicId, files, success, failure, contact) => {
if (contact) {
const { server, token, cardId } = contact;
const { server, cardId } = contact;
let host = "";
if (server) {
host = `https://${server}`
}
const controller = new AbortController();
const entry = {
index: index.current,

View File

@ -35,6 +35,7 @@ export function AddTopic({ contentKey }) {
modal.error({
title: 'Failed to Post Message',
content: 'Please try again.',
bodyStyle: { padding: 16 },
});
}
}

View File

@ -181,11 +181,11 @@ export function Details({ cardId, channelId, closeDetails, closeConversation, op
</div>
</div>
<Modal title="Edit Subject" centered visible={state.editSubject} footer={editSubjectFooter}
onCancel={actions.clearEditSubject}>
bodyStyle={{ padding: 16 }} onCancel={actions.clearEditSubject}>
<EditSubject state={state} actions={actions} />
</Modal>
<Modal title="Edit Members" centered visible={state.editMembers} footer={editMembersFooter}
onCancel={actions.clearEditMembers}>
bodyStyle={{ padding: 16 }} onCancel={actions.clearEditMembers}>
<EditMembers state={state} actions={actions} />
</Modal>
</DetailsWrapper>