fix: chat error message
This commit is contained in:
parent
0fff1c3534
commit
6e10ca5dd2
|
@ -104,7 +104,6 @@ import {
|
|||
trackRemoved
|
||||
} from './react/features/base/tracks';
|
||||
import { getJitsiMeetGlobalNS } from './react/features/base/util';
|
||||
import { addMessage } from './react/features/chat';
|
||||
import { showDesktopPicker } from './react/features/desktop-picker';
|
||||
import { appendSuffix } from './react/features/display-name';
|
||||
import {
|
||||
|
@ -114,7 +113,6 @@ import {
|
|||
import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay';
|
||||
import { suspendDetected } from './react/features/power-monitor';
|
||||
import { setSharedVideoStatus } from './react/features/shared-video';
|
||||
import { isButtonEnabled } from './react/features/toolbox';
|
||||
import { endpointMessageReceived } from './react/features/subtitles';
|
||||
|
||||
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
||||
|
@ -244,8 +242,6 @@ class ConferenceConnector {
|
|||
this._handleConferenceJoined.bind(this));
|
||||
room.on(JitsiConferenceEvents.CONFERENCE_FAILED,
|
||||
this._onConferenceFailed.bind(this));
|
||||
room.on(JitsiConferenceEvents.CONFERENCE_ERROR,
|
||||
this._onConferenceError.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,31 +344,6 @@ class ConferenceConnector {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
_onConferenceError(err, ...params) {
|
||||
logger.error('CONFERENCE Error:', err, params);
|
||||
switch (err) {
|
||||
case JitsiConferenceErrors.CHAT_ERROR:
|
||||
logger.error('Chat error.', err);
|
||||
if (isButtonEnabled('chat') && !interfaceConfig.filmStripOnly) {
|
||||
const [ code, msg ] = params;
|
||||
|
||||
APP.store.dispatch(addMessage({
|
||||
hasRead: true,
|
||||
error: code,
|
||||
message: msg,
|
||||
messageType: 'error',
|
||||
timestamp: Date.now()
|
||||
}));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logger.error('Unknown error.', err);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"today": "Today"
|
||||
},
|
||||
"chat": {
|
||||
"error": "Error: your message \"{{originalText}}\" was not sent. Reason: {{error}}",
|
||||
"error": "Error: your message was not sent. Reason: {{error}}",
|
||||
"messagebox": "Type a message",
|
||||
"messageTo": "Private message to {{recipient}}",
|
||||
"nickname": {
|
||||
|
|
|
@ -11681,8 +11681,8 @@
|
|||
}
|
||||
},
|
||||
"lib-jitsi-meet": {
|
||||
"version": "github:jitsi/lib-jitsi-meet#16e08408aa3fa8303e236b9ffdb0dfce65e79bb7",
|
||||
"from": "github:jitsi/lib-jitsi-meet#16e08408aa3fa8303e236b9ffdb0dfce65e79bb7",
|
||||
"version": "github:jitsi/lib-jitsi-meet#f9808adb8eb523bae3318f9f8ef49b544651485f",
|
||||
"from": "github:jitsi/lib-jitsi-meet#f9808adb8eb523bae3318f9f8ef49b544651485f",
|
||||
"requires": {
|
||||
"@jitsi/sdp-interop": "0.1.14",
|
||||
"@jitsi/sdp-simulcast": "0.2.2",
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
"js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
|
||||
"jsrsasign": "8.0.12",
|
||||
"jwt-decode": "2.2.0",
|
||||
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#16e08408aa3fa8303e236b9ffdb0dfce65e79bb7",
|
||||
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#f9808adb8eb523bae3318f9f8ef49b544651485f",
|
||||
"libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
|
||||
"lodash": "4.17.13",
|
||||
"moment": "2.19.4",
|
||||
|
|
|
@ -77,6 +77,11 @@ declare var APP: Object;
|
|||
* @returns {void}
|
||||
*/
|
||||
function _addConferenceListeners(conference, dispatch) {
|
||||
// A simple logger for conference errors received through
|
||||
// the listener. These errors are not handled now, but logged.
|
||||
conference.on(JitsiConferenceEvents.CONFERENCE_ERROR,
|
||||
error => logger.error('Conference error.', error));
|
||||
|
||||
// Dispatches into features/base/conference follow:
|
||||
|
||||
conference.on(
|
||||
|
|
|
@ -57,6 +57,21 @@ export default class AbstractChatMessage<P: Props> extends PureComponent<P> {
|
|||
.format(TIMESTAMP_FORMAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the message text to be redered in the component.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
_getMessageText() {
|
||||
const { message } = this.props;
|
||||
|
||||
return message.messageType === 'error'
|
||||
? this.props.t('chat.error', {
|
||||
error: message.message
|
||||
})
|
||||
: message.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message that is displayed as a notice for private messages.
|
||||
*
|
||||
|
|
|
@ -47,13 +47,6 @@ class ChatMessage extends AbstractChatMessage<Props> {
|
|||
textWrapperStyle.push(styles.systemTextWrapper);
|
||||
}
|
||||
|
||||
const messageText = message.messageType === 'error'
|
||||
? this.props.t('chat.error', {
|
||||
error: message.error,
|
||||
originalText: message.message
|
||||
})
|
||||
: message.message;
|
||||
|
||||
return (
|
||||
<View style = { styles.messageWrapper } >
|
||||
{ this._renderAvatar() }
|
||||
|
@ -65,7 +58,7 @@ class ChatMessage extends AbstractChatMessage<Props> {
|
|||
&& this._renderDisplayName()
|
||||
}
|
||||
<Linkify linkStyle = { styles.chatLink }>
|
||||
{ replaceNonUnicodeEmojis(messageText) }
|
||||
{ replaceNonUnicodeEmojis(this._getMessageText()) }
|
||||
</Linkify>
|
||||
{
|
||||
message.privateMessage
|
||||
|
@ -87,6 +80,8 @@ class ChatMessage extends AbstractChatMessage<Props> {
|
|||
|
||||
_getFormattedTimestamp: () => string;
|
||||
|
||||
_getMessageText: () => string;
|
||||
|
||||
_getPrivateNoticeMessage: () => string;
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,17 +24,10 @@ class ChatMessage extends AbstractChatMessage<Props> {
|
|||
*/
|
||||
render() {
|
||||
const { message } = this.props;
|
||||
const messageToDisplay = message.messageType === 'error'
|
||||
? this.props.t('chat.error', {
|
||||
error: message.error,
|
||||
originalText: message.message
|
||||
})
|
||||
: message.message;
|
||||
|
||||
const processedMessage = [];
|
||||
|
||||
// content is an array of text and emoji components
|
||||
const content = toArray(messageToDisplay, { className: 'smiley' });
|
||||
const content = toArray(this._getMessageText(), { className: 'smiley' });
|
||||
|
||||
content.forEach(i => {
|
||||
if (typeof i === 'string') {
|
||||
|
@ -67,6 +60,8 @@ class ChatMessage extends AbstractChatMessage<Props> {
|
|||
|
||||
_getFormattedTimestamp: () => string;
|
||||
|
||||
_getMessageText: () => string;
|
||||
|
||||
_getPrivateNoticeMessage: () => string;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,10 @@ import {
|
|||
getCurrentConference
|
||||
} from '../base/conference';
|
||||
import { openDialog } from '../base/dialog';
|
||||
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
|
||||
import {
|
||||
JitsiConferenceErrors,
|
||||
JitsiConferenceEvents
|
||||
} from '../base/lib-jitsi-meet';
|
||||
import {
|
||||
getLocalParticipant,
|
||||
getParticipantById,
|
||||
|
@ -139,10 +142,10 @@ StateListenerRegistry.register(
|
|||
* @private
|
||||
* @returns {void}
|
||||
*/
|
||||
function _addChatMsgListener(conference, { dispatch, getState }) {
|
||||
function _addChatMsgListener(conference, store) {
|
||||
if ((typeof interfaceConfig === 'object' && interfaceConfig.filmStripOnly)
|
||||
|| (typeof APP !== 'undefined' && !isButtonEnabled('chat'))
|
||||
|| getState()['features/base/config'].iAmRecorder) {
|
||||
|| store.getState()['features/base/config'].iAmRecorder) {
|
||||
// We don't register anything on web if we're in filmStripOnly mode, or
|
||||
// the chat button is not enabled in interfaceConfig.
|
||||
// or we are in iAmRecorder mode
|
||||
|
@ -152,10 +155,7 @@ function _addChatMsgListener(conference, { dispatch, getState }) {
|
|||
conference.on(
|
||||
JitsiConferenceEvents.MESSAGE_RECEIVED,
|
||||
(id, message, timestamp, nick) => {
|
||||
_handleReceivedMessage({
|
||||
dispatch,
|
||||
getState
|
||||
}, {
|
||||
_handleReceivedMessage(store, {
|
||||
id,
|
||||
message,
|
||||
nick,
|
||||
|
@ -168,10 +168,7 @@ function _addChatMsgListener(conference, { dispatch, getState }) {
|
|||
conference.on(
|
||||
JitsiConferenceEvents.PRIVATE_MESSAGE_RECEIVED,
|
||||
(id, message, timestamp) => {
|
||||
_handleReceivedMessage({
|
||||
dispatch,
|
||||
getState
|
||||
}, {
|
||||
_handleReceivedMessage(store, {
|
||||
id,
|
||||
message,
|
||||
privateMessage: true,
|
||||
|
@ -180,6 +177,28 @@ function _addChatMsgListener(conference, { dispatch, getState }) {
|
|||
});
|
||||
}
|
||||
);
|
||||
|
||||
conference.on(
|
||||
JitsiConferenceEvents.CONFERENCE_ERROR, (errorType, error) => {
|
||||
errorType === JitsiConferenceErrors.CHAT_ERROR && _handleChatError(store, error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a chat error received from the xmpp server.
|
||||
*
|
||||
* @param {Store} store - The Redux store.
|
||||
* @param {string} error - The error message.
|
||||
* @returns {void}
|
||||
*/
|
||||
function _handleChatError({ dispatch }, error) {
|
||||
dispatch(addMessage({
|
||||
hasRead: true,
|
||||
messageType: 'error',
|
||||
message: error,
|
||||
privateMessage: false,
|
||||
timestamp: Date.now()
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue