Fix adding to group by username
This commit is contained in:
parent
e87062295e
commit
613d893f45
5 changed files with 31 additions and 26 deletions
|
@ -5001,11 +5001,6 @@ button.module-image__border-overlay:focus {
|
||||||
min-width: 20px;
|
min-width: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__spinner__container {
|
|
||||||
margin-left: 16px;
|
|
||||||
margin-right: 16px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&--header {
|
&--header {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { getClassNamesFor } from '../util/getClassNamesFor';
|
import { getClassNamesFor } from '../util/getClassNamesFor';
|
||||||
|
@ -53,6 +53,13 @@ export function CircleCheckbox({
|
||||||
throw missingCaseError(variant);
|
throw missingCaseError(variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onChangeWrapped = useCallback(
|
||||||
|
(ev: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
onChange?.(ev.target.checked);
|
||||||
|
},
|
||||||
|
[onChange]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(getClassName('__checkbox'), variantModifier)}>
|
<div className={classNames(getClassName('__checkbox'), variantModifier)}>
|
||||||
<input
|
<input
|
||||||
|
@ -61,7 +68,7 @@ export function CircleCheckbox({
|
||||||
aria-disabled={disabled}
|
aria-disabled={disabled}
|
||||||
id={id}
|
id={id}
|
||||||
name={name}
|
name={name}
|
||||||
onChange={onChange && (ev => onChange(ev.target.checked))}
|
onChange={onChangeWrapped}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
type={isRadio ? 'radio' : 'checkbox'}
|
type={isRadio ? 'radio' : 'checkbox'}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -10,7 +10,7 @@ import React, {
|
||||||
useRef,
|
useRef,
|
||||||
useCallback,
|
useCallback,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { noop, omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
import type { MeasuredComponentProps } from 'react-measure';
|
import type { MeasuredComponentProps } from 'react-measure';
|
||||||
import Measure from 'react-measure';
|
import Measure from 'react-measure';
|
||||||
import type { ListRowProps } from 'react-virtualized';
|
import type { ListRowProps } from 'react-virtualized';
|
||||||
|
@ -340,9 +340,9 @@ export function ChooseGroupMembersModal({
|
||||||
toggleConversationInChooseMembers={conversationId =>
|
toggleConversationInChooseMembers={conversationId =>
|
||||||
handleContactClick(conversationId, undefined)
|
handleContactClick(conversationId, undefined)
|
||||||
}
|
}
|
||||||
showUserNotFoundModal={noop}
|
showUserNotFoundModal={showUserNotFoundModal}
|
||||||
setIsFetchingUUID={setIsFetchingUUID}
|
setIsFetchingUUID={setIsFetchingUUID}
|
||||||
lookupConversationWithoutUuid={() => Promise.resolve(undefined)}
|
lookupConversationWithoutUuid={lookupConversationWithoutUuid}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState, useCallback } from 'react';
|
||||||
|
|
||||||
import { Button, ButtonIconType, ButtonVariant } from '../../Button';
|
import { Button, ButtonIconType, ButtonVariant } from '../../Button';
|
||||||
import { Tooltip } from '../../Tooltip';
|
import { Tooltip } from '../../Tooltip';
|
||||||
|
@ -204,6 +204,11 @@ export function ConversationDetails({
|
||||||
const cannotLeaveBecauseYouAreLastAdmin =
|
const cannotLeaveBecauseYouAreLastAdmin =
|
||||||
isAdmin && !isJustMe && !isAnyoneElseAnAdmin;
|
isAdmin && !isJustMe && !isAnyoneElseAnAdmin;
|
||||||
|
|
||||||
|
const onCloseModal = useCallback(() => {
|
||||||
|
setModalState(ModalState.NothingOpen);
|
||||||
|
setEditGroupAttributesRequestState(RequestState.Inactive);
|
||||||
|
}, []);
|
||||||
|
|
||||||
let modalNode: ReactNode;
|
let modalNode: ReactNode;
|
||||||
switch (modalState) {
|
switch (modalState) {
|
||||||
case ModalState.NothingOpen:
|
case ModalState.NothingOpen:
|
||||||
|
@ -242,10 +247,7 @@ export function ConversationDetails({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onClose={() => {
|
onClose={onCloseModal}
|
||||||
setModalState(ModalState.NothingOpen);
|
|
||||||
setEditGroupAttributesRequestState(RequestState.Inactive);
|
|
||||||
}}
|
|
||||||
requestState={editGroupAttributesRequestState}
|
requestState={editGroupAttributesRequestState}
|
||||||
title={conversation.title}
|
title={conversation.title}
|
||||||
deleteAvatarFromDisk={deleteAvatarFromDisk}
|
deleteAvatarFromDisk={deleteAvatarFromDisk}
|
||||||
|
@ -289,10 +291,7 @@ export function ConversationDetails({
|
||||||
}}
|
}}
|
||||||
maxGroupSize={maxGroupSize}
|
maxGroupSize={maxGroupSize}
|
||||||
maxRecommendedGroupSize={maxRecommendedGroupSize}
|
maxRecommendedGroupSize={maxRecommendedGroupSize}
|
||||||
onClose={() => {
|
onClose={onCloseModal}
|
||||||
setModalState(ModalState.NothingOpen);
|
|
||||||
setEditGroupAttributesRequestState(RequestState.Inactive);
|
|
||||||
}}
|
|
||||||
requestState={addGroupMembersRequestState}
|
requestState={addGroupMembersRequestState}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -303,9 +302,7 @@ export function ConversationDetails({
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
id={conversation.id}
|
id={conversation.id}
|
||||||
muteExpiresAt={conversation.muteExpiresAt}
|
muteExpiresAt={conversation.muteExpiresAt}
|
||||||
onClose={() => {
|
onClose={onCloseModal}
|
||||||
setModalState(ModalState.NothingOpen);
|
|
||||||
}}
|
|
||||||
setMuteExpiration={setMuteExpiration}
|
setMuteExpiration={setMuteExpiration}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -324,9 +321,7 @@ export function ConversationDetails({
|
||||||
hasXButton
|
hasXButton
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
title={i18n('ConversationDetails__unmute--title')}
|
title={i18n('ConversationDetails__unmute--title')}
|
||||||
onClose={() => {
|
onClose={onCloseModal}
|
||||||
setModalState(ModalState.NothingOpen);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{getMutedUntilText(Number(conversation.muteExpiresAt), i18n)}
|
{getMutedUntilText(Number(conversation.muteExpiresAt), i18n)}
|
||||||
</ConfirmationDialog>
|
</ConfirmationDialog>
|
||||||
|
|
|
@ -136,6 +136,14 @@ export async function lookupConversationWithoutUuid(
|
||||||
async function checkForUsername(
|
async function checkForUsername(
|
||||||
username: string
|
username: string
|
||||||
): Promise<FoundUsernameType | undefined> {
|
): Promise<FoundUsernameType | undefined> {
|
||||||
|
let hash: Buffer;
|
||||||
|
try {
|
||||||
|
hash = usernames.hash(username);
|
||||||
|
} catch (error) {
|
||||||
|
log.error('checkForUsername: invalid username', Errors.toLogFormat(error));
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const { server } = window.textsecure;
|
const { server } = window.textsecure;
|
||||||
if (!server) {
|
if (!server) {
|
||||||
throw new Error('server is not available!');
|
throw new Error('server is not available!');
|
||||||
|
@ -143,7 +151,7 @@ async function checkForUsername(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const account = await server.getAccountForUsername({
|
const account = await server.getAccountForUsername({
|
||||||
hash: usernames.hash(username),
|
hash,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!account.uuid) {
|
if (!account.uuid) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue