Emit composer-focus and contact toasts for DM and friends (Phase 452).
DM and group-DM opens now request composer autofocus, and friend/block actions surface success toasts for clearer P2P contacts UX. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1025,11 +1025,13 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
peerDisplayName: msg.peerDisplayName
|
||||
})
|
||||
pushState()
|
||||
send({ type: 'show-toast', message: 'Friend request sent on the contacts mesh' })
|
||||
return true
|
||||
}
|
||||
if (t === 'accept-friend-request') {
|
||||
await platform.acceptFriendRequest(msg.peerUserId)
|
||||
pushState()
|
||||
send({ type: 'show-toast', message: 'Friend request accepted' })
|
||||
return true
|
||||
}
|
||||
if (t === 'decline-friend-request') {
|
||||
@@ -1045,11 +1047,13 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
if (t === 'block-contact') {
|
||||
await platform.blockContact(msg.peerUserId)
|
||||
pushState()
|
||||
send({ type: 'show-toast', message: 'User blocked — they cannot send you friend requests' })
|
||||
return true
|
||||
}
|
||||
if (t === 'unblock-contact') {
|
||||
await platform.unblockContact(msg.peerUserId)
|
||||
pushState()
|
||||
send({ type: 'show-toast', message: 'User unblocked' })
|
||||
return true
|
||||
}
|
||||
if (t === 'request-attachment-preview') {
|
||||
@@ -1229,6 +1233,9 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
peerDisplayName: msg.peerDisplayName || msg.peerUserId?.slice(0, 8)
|
||||
})
|
||||
pushState()
|
||||
if (platform.activeChannelId) {
|
||||
send({ type: 'composer-focus-channel', channelId: platform.activeChannelId })
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (t === 'create-group-dm') {
|
||||
@@ -1237,11 +1244,17 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
name: msg.name
|
||||
})
|
||||
pushState()
|
||||
if (platform.activeChannelId) {
|
||||
send({ type: 'composer-focus-channel', channelId: platform.activeChannelId })
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (t === 'open-group-dm') {
|
||||
await platform.openGroupDM({ channelId: msg.channelId })
|
||||
pushState()
|
||||
if (platform.activeChannelId) {
|
||||
send({ type: 'composer-focus-channel', channelId: platform.activeChannelId })
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (t === 'typing-start' || t === 'typing') {
|
||||
|
||||
Reference in New Issue
Block a user