fix chat render for contacts
This commit is contained in:
parent
1519e36a61
commit
80d9a6f504
1 changed files with 13 additions and 4 deletions
|
|
@ -1547,10 +1547,19 @@ class extends Component {
|
|||
var contacts = [ ]
|
||||
if ( 'user_info' in frappe.boot ) {
|
||||
const emails = frappe.user.get_emails()
|
||||
for (const room of state.rooms)
|
||||
if ( room.type === 'Direct' )
|
||||
if ( !emails.includes(room.owner) || !emails.includes(frappe._.squash(room.users)) )
|
||||
contacts.append({ owner: frappe.session.user, users: [email] }) // placeholder.
|
||||
for (const email of emails) {
|
||||
var exists = false
|
||||
|
||||
for (const room of state.rooms) {
|
||||
if ( room.type === 'Direct' ) {
|
||||
if ( room.owner === email || frappe._.squash(room.users) === email )
|
||||
exists = true
|
||||
}
|
||||
}
|
||||
|
||||
if ( !exists )
|
||||
contacts.push({ owner: frappe.session.user, users: [email] })
|
||||
}
|
||||
}
|
||||
const rooms = state.query ? frappe.chat.room.search(state.query, state.rooms.concat(contacts)) : frappe.chat.room.sort(state.rooms)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue