mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 20:49:16 +00:00
open existing dm thread if exists
This commit is contained in:
parent
843a22c17b
commit
8d8b6c32e0
@ -45,10 +45,10 @@ export function CardItem({ item, tooltip, resync, open, call, message }) {
|
|||||||
)}
|
)}
|
||||||
{ item.status === 'connected' && (
|
{ item.status === 'connected' && (
|
||||||
<ComOptions>
|
<ComOptions>
|
||||||
<Tooltip className="option" placement="left" title="start a new topic">
|
<Tooltip className="option" placement="left" title="message contact">
|
||||||
<MessageOutlined onClick={onMessage} />
|
<MessageOutlined onClick={onMessage} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip className="option" placement="left" title="start a call">
|
<Tooltip className="option" placement="left" title="call contact">
|
||||||
<PhoneOutlined onClick={onCall} />
|
<PhoneOutlined onClick={onCall} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ComOptions>
|
</ComOptions>
|
||||||
|
@ -119,6 +119,18 @@ export function useCards() {
|
|||||||
await card.actions.resyncCard(cardId);
|
await card.actions.resyncCard(cardId);
|
||||||
},
|
},
|
||||||
message: async (cardId) => {
|
message: async (cardId) => {
|
||||||
|
let channelId = null;
|
||||||
|
channel.state.channels.forEach((entry, id) => {
|
||||||
|
const cards = entry?.data?.channelDetail?.contacts?.cards || [];
|
||||||
|
const subject = entry?.data?.channelDetail?.data || '';
|
||||||
|
const type = entry?.data?.channelDetail?.dataType || '';
|
||||||
|
if (cards.length === 1 && cards[0] === cardId && type === 'superbasic' && subject === '{"subject":null}') {
|
||||||
|
channelId = entry.id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (channelId != null) {
|
||||||
|
return channelId;
|
||||||
|
}
|
||||||
const conversation = await channel.actions.addChannel('superbasic', { subject: null }, [ cardId ]);
|
const conversation = await channel.actions.addChannel('superbasic', { subject: null }, [ cardId ]);
|
||||||
return conversation.id;
|
return conversation.id;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user