fix(chat/native) private message replies (#11521)

Fixes issue #11516
This commit is contained in:
Calinteodor 2022-05-10 18:28:23 +03:00 committed by GitHub
parent 9d7b6cafc5
commit 0fe7383154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -6,7 +6,6 @@ import React, { useEffect } from 'react';
import { translate } from '../../../base/i18n';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { connect } from '../../../base/redux';
import { closeChat, openChat } from '../../actions.native';
import AbstractChat, {
_mapStateToProps,
type Props as AbstractProps
@ -69,26 +68,19 @@ class Chat extends AbstractChat<Props> {
export default translate(connect(_mapStateToProps)(props => {
const {
_nbUnreadMessages,
dispatch,
navigation,
route,
t
} = props;
const isChatScreenFocused = useIsFocused();
const privateMessageRecipient = route.params?.privateMessageRecipient;
const nrUnreadMessages
= !isChatScreenFocused && _nbUnreadMessages > 0
? `(${_nbUnreadMessages})` : '';
useEffect(() => {
dispatch(openChat(privateMessageRecipient));
navigation.setOptions({
tabBarLabel: `${t('chat.tabs.chat')} ${nrUnreadMessages}`
});
return () => dispatch(closeChat());
}, [ nrUnreadMessages ]);
return (

View File

@ -58,7 +58,7 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
toggledIcon = IconReply;
/**
* Handles clicking / pressing the button, and kicks the participant.
* Handles clicking / pressing the button.
*
* @private
* @returns {void}
@ -67,6 +67,7 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
if (this.props._isLobbyMessage) {
this.props.dispatch(handleLobbyChatInitialized(this.props.participantID));
}
this.props._isPollsDisabled
? navigate(screen.conference.chat, {
privateMessageRecipient: this.props._participant
@ -102,11 +103,11 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
export function _mapStateToProps(state: Object, ownProps: Props): $Shape<Props> {
const enabled = getFeatureFlag(state, CHAT_ENABLED, true);
const { disablePolls } = state['features/base/config'];
const { visible = enabled, isLobbyMessage } = ownProps;
const { visible = enabled, isLobbyMessage, participantID } = ownProps;
return {
_isPollsDisabled: disablePolls,
_participant: getParticipantById(state, ownProps.participantID),
_participant: getParticipantById(state, participantID),
_isLobbyMessage: isLobbyMessage,
visible
};