Удалены чувствительные данные
This commit is contained in:
@@ -17,13 +17,20 @@ export default function ForwardModal({ onClose, onForward }: ForwardModalProps)
|
||||
const { t } = useLang();
|
||||
const [search, setSearch] = useState('');
|
||||
|
||||
const filteredChats = chats.filter((chat) => {
|
||||
const otherMember = chat.members.find((m) => m.userId !== user?.id);
|
||||
const chatName = chat.type === 'personal'
|
||||
? otherMember?.user.displayName || otherMember?.user.username || t('chat')
|
||||
: chat.name || t('group');
|
||||
return chatName.toLowerCase().includes(search.toLowerCase());
|
||||
});
|
||||
const filteredChats = chats
|
||||
.filter((chat) => {
|
||||
const otherMember = chat.members.find((m) => m.userId !== user?.id);
|
||||
const chatName = chat.type === 'personal'
|
||||
? otherMember?.user.displayName || otherMember?.user.username || t('favorites')
|
||||
: chat.name || t('group');
|
||||
const finalName = chat.type === 'favorites' ? t('favorites') : chatName;
|
||||
return finalName.toLowerCase().includes(search.toLowerCase());
|
||||
})
|
||||
.sort((a, b) => {
|
||||
if (a.type === 'favorites') return -1;
|
||||
if (b.type === 'favorites') return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
|
||||
@@ -68,9 +75,11 @@ export default function ForwardModal({ onClose, onForward }: ForwardModalProps)
|
||||
<div className="max-h-80 overflow-y-auto space-y-1 pr-2 custom-scrollbar">
|
||||
{filteredChats.map((chat) => {
|
||||
const otherMember = chat.members.find((m) => m.userId !== user?.id);
|
||||
const chatName = chat.type === 'personal'
|
||||
? otherMember?.user.displayName || otherMember?.user.username || t('chat')
|
||||
: chat.name || t('group');
|
||||
const chatName =
|
||||
chat.type === 'favorites' ? t('favorites') :
|
||||
chat.type === 'personal'
|
||||
? otherMember?.user.displayName || otherMember?.user.username || t('chat')
|
||||
: chat.name || t('group');
|
||||
const chatAvatar = chat.type === 'personal'
|
||||
? otherMember?.user.avatar
|
||||
: chat.avatar;
|
||||
|
||||
Reference in New Issue
Block a user