chore: address PR review

pull/3281/head
Audric Ackermann 10 months ago
parent 1b223beba1
commit 767178419e
No known key found for this signature in database

@ -200,10 +200,6 @@ const GroupStatusText = ({ groupPk, pubkey }: { pubkey: PubkeyType; groupPk: Gro
return null; return null;
} }
/**
* Note: Keep the "sending" checks here first, as we might be "sending" when we've previously failed.
* If we were to have the "failed" checks first, we'd hide the "sending" state when we are retrying.
*/
const statusText = localisedStatusFromMemberStatus(memberStatus); const statusText = localisedStatusFromMemberStatus(memberStatus);
if (!statusText) { if (!statusText) {
return null; return null;

@ -1,4 +1,4 @@
import { useCallback } from 'react'; import useAsyncFn from 'react-use/lib/useAsyncFn';
import { WithMessageId } from '../../../../session/types/with'; import { WithMessageId } from '../../../../session/types/with';
import { useMessageDirection, useMessageStatus } from '../../../../state/selectors'; import { useMessageDirection, useMessageStatus } from '../../../../state/selectors';
import { ItemWithDataTestId } from '../MenuItemWithDataTestId'; import { ItemWithDataTestId } from '../MenuItemWithDataTestId';
@ -12,7 +12,7 @@ export const RetryItem = ({ messageId }: WithMessageId) => {
const showRetry = status === 'error' && isOutgoing; const showRetry = status === 'error' && isOutgoing;
const onRetry = useCallback(async () => { const [, doResend] = useAsyncFn(async () => {
const found = await Data.getMessageById(messageId); const found = await Data.getMessageById(messageId);
if (found) { if (found) {
await found.retrySend(); await found.retrySend();
@ -21,6 +21,6 @@ export const RetryItem = ({ messageId }: WithMessageId) => {
return showRetry ? ( return showRetry ? (
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
<ItemWithDataTestId onClick={onRetry}>{window.i18n('resend')}</ItemWithDataTestId> <ItemWithDataTestId onClick={() => doResend()}>{window.i18n('resend')}</ItemWithDataTestId>
) : null; ) : null;
}; };

@ -2441,7 +2441,6 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
flags, flags,
}); });
// no need to trigger a UI update now, we trigger a messagesAdded just below
const messageId = await model.commit(true); const messageId = await model.commit(true);
model.set({ id: messageId }); model.set({ id: messageId });

@ -86,8 +86,11 @@ export class PubKey {
public static shorten(value: string | PubKey): string { public static shorten(value: string | PubKey): string {
const valAny = value as PubKey; const valAny = value as PubKey;
const pk = value instanceof PubKey ? valAny.key : value; const pk = value instanceof PubKey ? valAny.key : value;
if (!pk) {
throw new Error('PubKey.shorten was given an invalid PubKey to shorten.');
}
if (!pk || pk.length < 8) { if (pk.length < 8) {
return pk; return pk;
} }

Loading…
Cancel
Save