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 type { VideoFrameSource } from 'ringrtc';
|
||||
import type {
|
||||
ActiveCallStateType,
|
||||
SetLocalAudioType,
|
||||
SetLocalPreviewType,
|
||||
SetLocalVideoType,
|
||||
SetRendererCanvasType,
|
||||
} from '../state/ducks/calling';
|
||||
import { isInSpeakerView } from '../state/selectors/calling';
|
||||
import { Avatar } from './Avatar';
|
||||
import { CallingHeader } from './CallingHeader';
|
||||
import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo';
|
||||
|
@ -25,6 +25,7 @@ import type {
|
|||
} from '../types/Calling';
|
||||
import {
|
||||
CallMode,
|
||||
CallViewMode,
|
||||
CallState,
|
||||
GroupCallConnectionState,
|
||||
GroupCallJoinState,
|
||||
|
@ -77,6 +78,15 @@ type DirectCallHeaderMessagePropsType = {
|
|||
joinedAt?: number;
|
||||
};
|
||||
|
||||
export const isInSpeakerView = (
|
||||
call: Pick<ActiveCallStateType, 'viewMode'> | undefined
|
||||
): boolean => {
|
||||
return Boolean(
|
||||
call?.viewMode === CallViewMode.Presentation ||
|
||||
call?.viewMode === CallViewMode.Speaker
|
||||
);
|
||||
};
|
||||
|
||||
function DirectCallHeaderMessage({
|
||||
callState,
|
||||
i18n,
|
||||
|
|
|
@ -1371,8 +1371,8 @@ export function getMessagePropStatus(
|
|||
>,
|
||||
ourConversationId: string | undefined
|
||||
): LastMessageStatus | undefined {
|
||||
if (!isOutgoing(message)) {
|
||||
return undefined;
|
||||
if (isIncoming(message)) {
|
||||
return hasErrors(message) ? 'error' : undefined;
|
||||
}
|
||||
|
||||
if (getLastChallengeError(message)) {
|
||||
|
|
|
@ -351,12 +351,24 @@ describe('state/selectors/messages', () => {
|
|||
...overrides,
|
||||
});
|
||||
|
||||
it('returns undefined for incoming messages', () => {
|
||||
it('returns undefined for incoming messages with no errors', () => {
|
||||
const message = createMessage({ type: 'incoming' });
|
||||
|
||||
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', () => {
|
||||
const challengeError: ShallowChallengeError = Object.assign(
|
||||
new Error('a challenge'),
|
||||
|
|
Loading…
Add table
Reference in a new issue