2021-01-29 21:19:24 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
2024-03-13 20:44:13 +00:00
|
|
|
import React, { memo } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
2021-10-26 19:15:33 +00:00
|
|
|
import { GroupLinkManagement } from '../../components/conversation/conversation-details/GroupLinkManagement';
|
2021-01-29 21:19:24 +00:00
|
|
|
import { getConversationSelector } from '../selectors/conversations';
|
|
|
|
import { getIntl } from '../selectors/user';
|
2024-03-13 20:44:13 +00:00
|
|
|
import { useConversationsActions } from '../ducks/conversations';
|
2021-01-29 21:19:24 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export type SmartGroupLinkManagementProps = Readonly<{
|
2021-01-29 21:19:24 +00:00
|
|
|
conversationId: string;
|
2024-03-13 20:44:13 +00:00
|
|
|
}>;
|
2021-01-29 21:19:24 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export const SmartGroupLinkManagement = memo(function SmartGroupLinkManagement({
|
|
|
|
conversationId,
|
|
|
|
}: SmartGroupLinkManagementProps) {
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const conversationSelector = useSelector(getConversationSelector);
|
|
|
|
const conversation = conversationSelector(conversationId);
|
|
|
|
const isAdmin = conversation?.areWeAdmin ?? false;
|
|
|
|
const {
|
|
|
|
changeHasGroupLink,
|
|
|
|
generateNewGroupLink,
|
|
|
|
setAccessControlAddFromInviteLinkSetting,
|
|
|
|
} = useConversationsActions();
|
|
|
|
return (
|
|
|
|
<GroupLinkManagement
|
|
|
|
i18n={i18n}
|
|
|
|
changeHasGroupLink={changeHasGroupLink}
|
|
|
|
conversation={conversation}
|
|
|
|
generateNewGroupLink={generateNewGroupLink}
|
|
|
|
isAdmin={isAdmin}
|
|
|
|
setAccessControlAddFromInviteLinkSetting={
|
|
|
|
setAccessControlAddFromInviteLinkSetting
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
});
|