|
@@ -25,7 +25,7 @@ import ForwardBar from "./ForwardBar";
|
|
|
import ForwardSearchList from "./ForwardSearchList";
|
|
|
import {
|
|
|
sentMessageById, sentImgMessageById, sentAudioMessageById,
|
|
|
- sentVideoMessageById,sentFileMessageById,sentMessageReplyById
|
|
|
+ sentVideoMessageById,sentFileMessageById,sentMessageReplyById,sentMessageForwardById
|
|
|
} from '../../../../../api-data'
|
|
|
import { getChat } from '../../../../../redux/chat/selector'
|
|
|
import { getRightIsOpen } from '../../../../../redux/control/selector'
|
|
@@ -339,8 +339,8 @@ const SendMessage = ({isArrow,silentMode,isReply,setIsReply,isForward,setIsForwa
|
|
|
sentMessageReplyById(isReply._id, value, caption.trim())
|
|
|
setIsReply(undefined)
|
|
|
}
|
|
|
- if (value && !isReply && isForward) {
|
|
|
- console.log('Sent forwarded message to me')
|
|
|
+ if (!isReply && isForward) {
|
|
|
+ sentMessageForwardById(isForward._id,isForward.companionIdForwardToAndFrom)
|
|
|
setIsForward(undefined)
|
|
|
}
|
|
|
if (mediaBlobUrl && type === 'recording') {
|
|
@@ -494,10 +494,19 @@ const SendMessage = ({isArrow,silentMode,isReply,setIsReply,isForward,setIsForwa
|
|
|
|
|
|
useEffect(() => {
|
|
|
defaultState()
|
|
|
- }, [isReply,isForward,companionId])
|
|
|
+ }, [isReply, isForward, companionId])
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ setIsReply(undefined)
|
|
|
+ }, [companionId, setIsReply])
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ const companionIdForwardToAndFrom = isForward?.companionIdForwardToAndFrom
|
|
|
+ if(companionIdForwardToAndFrom&&companionIdForwardToAndFrom !== companionId) setIsForward(undefined)
|
|
|
+ },[companionId])
|
|
|
|
|
|
return (
|
|
|
- <div className={value || file || status === 'stopped' || _status === 'stopped' ?classes.containerActive:classes.container}>
|
|
|
+ <div className={value || file || status === 'stopped' || _status === 'stopped' || isForward ?classes.containerActive:classes.container}>
|
|
|
{isArrow && <div className={classes.borderTop}></div>}
|
|
|
{isReply && <ReplyBar isReply={isReply} handleCloseReply={handleCloseReply}
|
|
|
handleScrollToTheMessage={handleScrollToTheMessage} />}
|
|
@@ -540,13 +549,13 @@ const SendMessage = ({isArrow,silentMode,isReply,setIsReply,isForward,setIsForwa
|
|
|
style={{ display: status !== null || _status === 'stopped' || file || value || isFilming || isReply || isForward? 'none' : 'block' }} />
|
|
|
<SendIcon onClick={sentMessage} className={classes.avatarRight}
|
|
|
sx={{backgroundColor: '#ffffff',color: 'rgb(41, 139, 231)', width: 56, height: 56}}
|
|
|
- style={{display: value || file || status === 'stopped' || _status === 'stopped' ? 'block':'none' }}/>
|
|
|
+ style={{display: value || file || status === 'stopped' || _status === 'stopped' || isForward? 'block':'none' }}/>
|
|
|
<MicNoneIcon onClick={handleRecording} className={classes.avatarRight}
|
|
|
sx={{backgroundColor:'#ffffff',color: '#6b6b6b', width: 56, height: 56}}
|
|
|
style={{display: !value && !file && status !== 'stopped' && _status === null&&!isRecording && !isReply && !isForward ? 'block' : 'none'}}/>
|
|
|
<SentimentSatisfiedAltIcon onClick={handleOpenEmoji}
|
|
|
fontSize='medium' sx={{color: isOpenEmoji ? 'rgb(41, 139, 231)' : '#6b6b6b', cursor: 'pointer',
|
|
|
- pointerEvents: file || status || _status ? 'none' : "auto",
|
|
|
+ pointerEvents: file || status || _status || isForward ? 'none' : "auto",
|
|
|
'&:hover': { color: 'rgb(41, 139, 231)' }, marginRight:1}}/>
|
|
|
<CommentIcon onClick={handleOpenCaption}
|
|
|
fontSize='medium' sx={{color: isOpenCaption || caption ? 'rgb(41, 139, 231)' : '#6b6b6b', cursor: 'pointer',
|
|
@@ -575,9 +584,9 @@ const SendMessage = ({isArrow,silentMode,isReply,setIsReply,isForward,setIsForwa
|
|
|
</InputAdornment>
|
|
|
),}}/>
|
|
|
</div>
|
|
|
- <textarea disabled={file || type === 'recording' || type === 'filming' ? true : false} value={value} onBlur={handleBlurTextarea}
|
|
|
+ <textarea disabled={file || type === 'recording' || type === 'filming' || isForward? true : false} value={value} onBlur={handleBlurTextarea}
|
|
|
onFocus={handleFocusTextarea} onChange={handleTextarea} className={classes.textarea}
|
|
|
- placeholder={file ? 'The File is ready to send' : status === null && _status === null ? 'Message' :
|
|
|
+ placeholder={file || isForward ? `${file?'The File is ready to send':'Forward Message is ready to send'}` : status === null && _status === null ? 'Message' :
|
|
|
`${status === 'stopped' || _status === 'stopped' ? type === 'recording' || type === 'filming'?'Recorded':'Message':'Recording in progress...'}`} rows={1}
|
|
|
style={{color:value || file || type === 'recording' || type === 'filming' ?'rgb(41, 139, 231)':'#6b6b6b'}}>
|
|
|
</textarea>
|