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; let node = cardProfile.node;
if (files?.length) { if (files?.length) {
const topicId = await addContactChannelTopic(node, token, channelId, null, null, null); 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); const subject = message(assets);
await setContactChannelTopicSubject(node, token, channelId, topicId, type, subject); await setContactChannelTopicSubject(node, token, channelId, topicId, type, subject);
}, async () => { }, async () => {
@ -294,7 +295,7 @@ export function useCardContext() {
catch(err) { catch(err) {
console.log(err); console.log(err);
} }
}); }, contact);
} }
else { else {
const subject = message([]); const subject = message([]);

View File

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

View File

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

View File

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