Merge pull request #5300 from achillesrasquinha/fchat-fixes
avoid re-rendering multiple chat rooms
This commit is contained in:
commit
d998b37a4e
1 changed files with 7 additions and 4 deletions
|
|
@ -1545,10 +1545,13 @@ class extends Component {
|
|||
})
|
||||
|
||||
var contacts = [ ]
|
||||
if ( 'user_info' in frappe.boot )
|
||||
contacts = Object.keys(frappe.boot.user_info).map(key => {
|
||||
return { owner: frappe.session.user, users: [frappe.boot.user_info[key].email] }
|
||||
})
|
||||
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.
|
||||
}
|
||||
const rooms = state.query ? frappe.chat.room.search(state.query, state.rooms.concat(contacts)) : frappe.chat.room.sort(state.rooms)
|
||||
|
||||
const RoomList = frappe._.is_empty(rooms) && !state.query ?
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue