Clicking a group in groups-in-common takes you to that conversation

This commit is contained in:
Alvaro 2022-10-06 09:18:48 -06:00 committed by GitHub
parent 6700d2f196
commit 89e25fb7e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View file

@ -78,6 +78,7 @@ const createProps = (hasGroupLink = false, expireTimer?: number): Props => ({
showConversationNotificationsSettings: action( showConversationNotificationsSettings: action(
'showConversationNotificationsSettings' 'showConversationNotificationsSettings'
), ),
showConversation: action('showConversation'),
showPendingInvites: action('showPendingInvites'), showPendingInvites: action('showPendingInvites'),
showLightboxForMedia: action('showLightboxForMedia'), showLightboxForMedia: action('showLightboxForMedia'),
updateGroupAttributes: async () => { updateGroupAttributes: async () => {

View file

@ -6,7 +6,10 @@ import React, { useState } from 'react';
import { Button, ButtonIconType, ButtonVariant } from '../../Button'; import { Button, ButtonIconType, ButtonVariant } from '../../Button';
import { Tooltip } from '../../Tooltip'; import { Tooltip } from '../../Tooltip';
import type { ConversationType } from '../../../state/ducks/conversations'; import type {
ConversationType,
ShowConversationType,
} from '../../../state/ducks/conversations';
import type { PreferredBadgeSelectorType } from '../../../state/selectors/badges'; import type { PreferredBadgeSelectorType } from '../../../state/selectors/badges';
import type { SmartChooseGroupMembersModalPropsType } from '../../../state/smart/ChooseGroupMembersModal'; import type { SmartChooseGroupMembersModalPropsType } from '../../../state/smart/ChooseGroupMembersModal';
import type { SmartConfirmAdditionsModalPropsType } from '../../../state/smart/ConfirmAdditionsModal'; import type { SmartConfirmAdditionsModalPropsType } from '../../../state/smart/ConfirmAdditionsModal';
@ -113,6 +116,7 @@ type ActionProps = {
replaceAvatar: ReplaceAvatarActionType; replaceAvatar: ReplaceAvatarActionType;
saveAvatarToDisk: SaveAvatarToDiskActionType; saveAvatarToDisk: SaveAvatarToDiskActionType;
showContactModal: (contactId: string, conversationId?: string) => void; showContactModal: (contactId: string, conversationId?: string) => void;
showConversation: ShowConversationType;
toggleSafetyNumberModal: (conversationId: string) => unknown; toggleSafetyNumberModal: (conversationId: string) => unknown;
searchInConversation: (id: string) => unknown; searchInConversation: (id: string) => unknown;
toggleAddUserToAnotherGroupModal: (contactId?: string) => void; toggleAddUserToAnotherGroupModal: (contactId?: string) => void;
@ -155,6 +159,7 @@ export const ConversationDetails: React.ComponentType<Props> = ({
showChatColorEditor, showChatColorEditor,
showContactModal, showContactModal,
showConversationNotificationsSettings, showConversationNotificationsSettings,
showConversation,
showGroupLinkManagement, showGroupLinkManagement,
showGroupV2Permissions, showGroupV2Permissions,
showLightboxForMedia, showLightboxForMedia,
@ -530,6 +535,7 @@ export const ConversationDetails: React.ComponentType<Props> = ({
i18n={i18n} i18n={i18n}
groupsInCommon={groupsInCommon} groupsInCommon={groupsInCommon}
toggleAddUserToAnotherGroupModal={toggleAddUserToAnotherGroupModal} toggleAddUserToAnotherGroupModal={toggleAddUserToAnotherGroupModal}
showConversation={showConversation}
/> />
)} )}

View file

@ -2,7 +2,10 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import React from 'react'; import React from 'react';
import type { ConversationType } from '../../../state/ducks/conversations'; import type {
ConversationType,
ShowConversationType,
} from '../../../state/ducks/conversations';
import type { LocalizerType } from '../../../types/Util'; import type { LocalizerType } from '../../../types/Util';
import { Avatar } from '../../Avatar'; import { Avatar } from '../../Avatar';
import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon';
@ -14,6 +17,7 @@ type Props = {
i18n: LocalizerType; i18n: LocalizerType;
groupsInCommon: Array<ConversationType>; groupsInCommon: Array<ConversationType>;
toggleAddUserToAnotherGroupModal: (contactId?: string) => void; toggleAddUserToAnotherGroupModal: (contactId?: string) => void;
showConversation: ShowConversationType;
}; };
export const ConversationDetailsGroups = ({ export const ConversationDetailsGroups = ({
@ -21,6 +25,7 @@ export const ConversationDetailsGroups = ({
i18n, i18n,
groupsInCommon, groupsInCommon,
toggleAddUserToAnotherGroupModal, toggleAddUserToAnotherGroupModal,
showConversation,
}: Props): JSX.Element => { }: Props): JSX.Element => {
const [showAllGroups, setShowAllGroups] = React.useState(false); const [showAllGroups, setShowAllGroups] = React.useState(false);
@ -44,6 +49,12 @@ export const ConversationDetailsGroups = ({
{groupsInCommon.slice(0, groupsToShow).map(group => ( {groupsInCommon.slice(0, groupsToShow).map(group => (
<PanelRow <PanelRow
key={group.id} key={group.id}
onClick={() =>
showConversation({
conversationId: group.id,
switchToAssociatedView: true,
})
}
icon={ icon={
<Avatar <Avatar
conversationType="group" conversationType="group"