Delete chat: Allow to leave; Seen By: Better view (#1749)
This commit is contained in:
parent
2ce560cf1a
commit
139bc84174
@ -108,6 +108,15 @@ const DeleteChatModal: FC<OwnProps & StateProps> = ({
|
|||||||
deleteChannel,
|
deleteChannel,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const handleLeaveChat = useCallback(() => {
|
||||||
|
if (isChannel || isSuperGroup) {
|
||||||
|
leaveChannel({ chatId: chat.id });
|
||||||
|
onClose();
|
||||||
|
} else {
|
||||||
|
handleDeleteChat();
|
||||||
|
}
|
||||||
|
}, [chat.id, handleDeleteChat, isChannel, isSuperGroup, leaveChannel, onClose]);
|
||||||
|
|
||||||
function renderHeader() {
|
function renderHeader() {
|
||||||
return (
|
return (
|
||||||
<div className="modal-header" dir={lang.isRtl ? 'rtl' : undefined}>
|
<div className="modal-header" dir={lang.isRtl ? 'rtl' : undefined}>
|
||||||
@ -183,7 +192,17 @@ const DeleteChatModal: FC<OwnProps & StateProps> = ({
|
|||||||
{contactName ? renderText(lang('ChatList.DeleteForEveryone', contactName)) : lang('DeleteForAll')}
|
{contactName ? renderText(lang('ChatList.DeleteForEveryone', contactName)) : lang('DeleteForAll')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button color="danger" className="confirm-dialog-button" isText onClick={handleDeleteChat}>
|
{!isPrivateChat && chat.isCreator && (
|
||||||
|
<Button color="danger" className="confirm-dialog-button" isText onClick={handleDeleteChat}>
|
||||||
|
{lang('DeleteForAll')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
color="danger"
|
||||||
|
className="confirm-dialog-button"
|
||||||
|
isText
|
||||||
|
onClick={isPrivateChat ? handleDeleteChat : handleLeaveChat}
|
||||||
|
>
|
||||||
{lang(renderActionText())}
|
{lang(renderActionText())}
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="confirm-dialog-button" isText onClick={onClose}>{lang('Cancel')}</Button>
|
<Button className="confirm-dialog-button" isText onClick={onClose}>{lang('Cancel')}</Button>
|
||||||
|
|||||||
@ -46,7 +46,7 @@ const SeenByModal: FC<OwnProps & StateProps> = ({
|
|||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onClose={closeSeenByModal}
|
onClose={closeSeenByModal}
|
||||||
className="narrow"
|
className="narrow"
|
||||||
title="Which users read the message"
|
title={`Seen by ${memberIds?.length} users`}
|
||||||
>
|
>
|
||||||
<div dir={lang.isRtl ? 'rtl' : undefined}>
|
<div dir={lang.isRtl ? 'rtl' : undefined}>
|
||||||
{renderingMemberIds && renderingMemberIds.map((userId) => (
|
{renderingMemberIds && renderingMemberIds.map((userId) => (
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { IAnchorPosition } from '../../../types';
|
|||||||
|
|
||||||
import { getMessageCopyOptions } from './helpers/copyOptions';
|
import { getMessageCopyOptions } from './helpers/copyOptions';
|
||||||
import { disableScrolling, enableScrolling } from '../../../util/scrollLock';
|
import { disableScrolling, enableScrolling } from '../../../util/scrollLock';
|
||||||
|
import { getUserFullName } from '../../../modules/helpers';
|
||||||
import useContextMenuPosition from '../../../hooks/useContextMenuPosition';
|
import useContextMenuPosition from '../../../hooks/useContextMenuPosition';
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
import buildClassName from '../../../util/buildClassName';
|
import buildClassName from '../../../util/buildClassName';
|
||||||
@ -259,9 +260,12 @@ const MessageContextMenu: FC<OwnProps> = ({
|
|||||||
? lang('Chat.OutgoingContextMixedReactionCount', [message.reactors.count, message.seenByUserIds.length])
|
? lang('Chat.OutgoingContextMixedReactionCount', [message.reactors.count, message.seenByUserIds.length])
|
||||||
: lang('Chat.ContextReactionCount', message.reactors.count, 'i')
|
: lang('Chat.ContextReactionCount', message.reactors.count, 'i')
|
||||||
) : (
|
) : (
|
||||||
message.seenByUserIds?.length
|
message.seenByUserIds?.length === 1 && seenByRecentUsers
|
||||||
? lang('Conversation.ContextMenuSeen', message.seenByUserIds.length, 'i')
|
? getUserFullName(seenByRecentUsers[0])
|
||||||
: lang('Conversation.ContextMenuNoViews')
|
: (message.seenByUserIds?.length
|
||||||
|
? lang('Conversation.ContextMenuSeen', message.seenByUserIds.length, 'i')
|
||||||
|
: lang('Conversation.ContextMenuNoViews')
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
<div className="avatars">
|
<div className="avatars">
|
||||||
{seenByRecentUsers?.map((user) => (
|
{seenByRecentUsers?.map((user) => (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user