|
@@ -8,8 +8,8 @@ import MessageLeft from './Messages/MessageLeft'
|
|
|
import MessageRight from './Messages/MessagesRight'
|
|
|
import AlertInfo from "../../../reusableComponents/AlertInfo";
|
|
|
import { getMessages } from '../../../../redux/messages/selector'
|
|
|
-import { getId } from '../../../../redux/authorization/selector'
|
|
|
-import { getChat } from '../../../../redux/chats/selector'
|
|
|
+import { getNumber } from '../../../../redux/authorization/selector'
|
|
|
+import { getChat } from '../../../../redux/chat/selector'
|
|
|
import { asyncGetMessagesById } from '../../../../redux/messages/operations'
|
|
|
const debounce = require('lodash.debounce');
|
|
|
|
|
@@ -37,7 +37,7 @@ const ChatBar = () => {
|
|
|
const classes = useStyles();
|
|
|
const dispatch = useDispatch()
|
|
|
const messages = useSelector(getMessages)
|
|
|
- const userId = useSelector(getId)
|
|
|
+ const userNumber = useSelector(getNumber)
|
|
|
const {companionId} = useSelector(getChat)
|
|
|
const [isArrow,setIsArrow] = useState<boolean>(false)
|
|
|
const divRef = useRef<any | null>(null)
|
|
@@ -67,8 +67,8 @@ const ChatBar = () => {
|
|
|
return (
|
|
|
<div ref={divRef} className={classes.container} onScroll={debouncedHandleScroll}>
|
|
|
<div className={classes.messagesBody}>
|
|
|
- {messages.length > 0 ? messages.map(({message,avatarUrl,name,lastName,color,updatedAt,owner:{_id}}:any,i:number) => {
|
|
|
- if (_id !== userId) {
|
|
|
+ {messages.length > 0 ? messages.map(({message,avatarUrl,name,lastName,color,updatedAt,number}:any,i:number) => {
|
|
|
+ if (number !== userNumber) {
|
|
|
return (
|
|
|
<MessageLeft
|
|
|
key={shortid.generate()}
|