Restore useful bubble for incoming messages with errors
This commit is contained in:
parent
6668348197
commit
6f2b01d98b
3 changed files with 26 additions and 4 deletions
|
@ -7,12 +7,12 @@ import { noop } from 'lodash';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import type { VideoFrameSource } from 'ringrtc';
|
import type { VideoFrameSource } from 'ringrtc';
|
||||||
import type {
|
import type {
|
||||||
|
ActiveCallStateType,
|
||||||
SetLocalAudioType,
|
SetLocalAudioType,
|
||||||
SetLocalPreviewType,
|
SetLocalPreviewType,
|
||||||
SetLocalVideoType,
|
SetLocalVideoType,
|
||||||
SetRendererCanvasType,
|
SetRendererCanvasType,
|
||||||
} from '../state/ducks/calling';
|
} from '../state/ducks/calling';
|
||||||
import { isInSpeakerView } from '../state/selectors/calling';
|
|
||||||
import { Avatar } from './Avatar';
|
import { Avatar } from './Avatar';
|
||||||
import { CallingHeader } from './CallingHeader';
|
import { CallingHeader } from './CallingHeader';
|
||||||
import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo';
|
import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo';
|
||||||
|
@ -25,6 +25,7 @@ import type {
|
||||||
} from '../types/Calling';
|
} from '../types/Calling';
|
||||||
import {
|
import {
|
||||||
CallMode,
|
CallMode,
|
||||||
|
CallViewMode,
|
||||||
CallState,
|
CallState,
|
||||||
GroupCallConnectionState,
|
GroupCallConnectionState,
|
||||||
GroupCallJoinState,
|
GroupCallJoinState,
|
||||||
|
@ -77,6 +78,15 @@ type DirectCallHeaderMessagePropsType = {
|
||||||
joinedAt?: number;
|
joinedAt?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isInSpeakerView = (
|
||||||
|
call: Pick<ActiveCallStateType, 'viewMode'> | undefined
|
||||||
|
): boolean => {
|
||||||
|
return Boolean(
|
||||||
|
call?.viewMode === CallViewMode.Presentation ||
|
||||||
|
call?.viewMode === CallViewMode.Speaker
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
function DirectCallHeaderMessage({
|
function DirectCallHeaderMessage({
|
||||||
callState,
|
callState,
|
||||||
i18n,
|
i18n,
|
||||||
|
|
|
@ -1371,8 +1371,8 @@ export function getMessagePropStatus(
|
||||||
>,
|
>,
|
||||||
ourConversationId: string | undefined
|
ourConversationId: string | undefined
|
||||||
): LastMessageStatus | undefined {
|
): LastMessageStatus | undefined {
|
||||||
if (!isOutgoing(message)) {
|
if (isIncoming(message)) {
|
||||||
return undefined;
|
return hasErrors(message) ? 'error' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getLastChallengeError(message)) {
|
if (getLastChallengeError(message)) {
|
||||||
|
|
|
@ -351,12 +351,24 @@ describe('state/selectors/messages', () => {
|
||||||
...overrides,
|
...overrides,
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns undefined for incoming messages', () => {
|
it('returns undefined for incoming messages with no errors', () => {
|
||||||
const message = createMessage({ type: 'incoming' });
|
const message = createMessage({ type: 'incoming' });
|
||||||
|
|
||||||
assert.isUndefined(getMessagePropStatus(message, ourConversationId));
|
assert.isUndefined(getMessagePropStatus(message, ourConversationId));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns "error" for incoming messages with errors', () => {
|
||||||
|
const message = createMessage({
|
||||||
|
type: 'incoming',
|
||||||
|
errors: [new Error('something went wrong')],
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
getMessagePropStatus(message, ourConversationId),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns "paused" for messages with challenges', () => {
|
it('returns "paused" for messages with challenges', () => {
|
||||||
const challengeError: ShallowChallengeError = Object.assign(
|
const challengeError: ShallowChallengeError = Object.assign(
|
||||||
new Error('a challenge'),
|
new Error('a challenge'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue