From cc6a403bf742d779efe30eec7703c104a3c10b6b Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Wed, 6 Jul 2022 17:08:50 -0300 Subject: [PATCH] [FIX] Room header not updating when room type changes (#4330) --- app/views/RoomView/index.tsx | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/app/views/RoomView/index.tsx b/app/views/RoomView/index.tsx index c93fb91b0..f66a09c3b 100644 --- a/app/views/RoomView/index.tsx +++ b/app/views/RoomView/index.tsx @@ -146,7 +146,8 @@ const roomAttrsUpdate = [ 'teamId', 'status', 'lastMessage', - 'onHold' + 'onHold', + 't' ] as TRoomUpdate[]; interface IRoomViewProps extends IBaseScreen { @@ -392,12 +393,6 @@ class RoomView extends React.Component { this.list.current?.query(); } } - // If it's not direct message - if (this.t !== 'd') { - if (roomUpdate.topic !== prevState.roomUpdate.topic) { - this.setHeader(); - } - } // If it's a livechat room if (this.t === 'l') { if ( @@ -409,18 +404,7 @@ class RoomView extends React.Component { this.updateOmnichannel(); } } - if (roomUpdate.teamMain !== prevState.roomUpdate.teamMain || roomUpdate.teamId !== prevState.roomUpdate.teamId) { - this.setHeader(); - } - if ( - (roomUpdate.fname !== prevState.roomUpdate.fname || - roomUpdate.name !== prevState.roomUpdate.name || - roomUpdate.teamMain !== prevState.roomUpdate.teamMain || - roomUpdate.teamId !== prevState.roomUpdate.teamId) && - !this.tmid - ) { - this.setHeader(); - } + if (roomAttrsUpdate.some(key => !dequal(prevState.roomUpdate[key], roomUpdate[key]))) this.setHeader(); if (insets.left !== prevProps.insets.left || insets.right !== prevProps.insets.right) { this.setHeader(); }