mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +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' && (
|
||||
<ComOptions>
|
||||
<Tooltip className="option" placement="left" title="start a new topic">
|
||||
<Tooltip className="option" placement="left" title="message contact">
|
||||
<MessageOutlined onClick={onMessage} />
|
||||
</Tooltip>
|
||||
<Tooltip className="option" placement="left" title="start a call">
|
||||
<Tooltip className="option" placement="left" title="call contact">
|
||||
<PhoneOutlined onClick={onCall} />
|
||||
</Tooltip>
|
||||
</ComOptions>
|
||||
|
@ -119,6 +119,18 @@ export function useCards() {
|
||||
await card.actions.resyncCard(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 ]);
|
||||
return conversation.id;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user