2023-05-20 02:30:24 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
|
|
|
import { indexOf } from '/imports/utils/array-utils';
|
|
|
|
|
|
|
|
// old code
|
|
|
|
const CLOSED_CHAT_LIST_KEY = 'closedChatList';
|
2023-09-14 00:37:40 +08:00
|
|
|
const closePrivateChat = (chatId: string) => {
|
2023-05-20 02:30:24 +08:00
|
|
|
const currentClosedChats = (Storage.getItem(CLOSED_CHAT_LIST_KEY) || []) as string[];
|
|
|
|
|
|
|
|
if (indexOf(currentClosedChats, chatId) < 0) {
|
|
|
|
currentClosedChats.push(chatId);
|
|
|
|
|
|
|
|
Storage.setItem(CLOSED_CHAT_LIST_KEY, currentClosedChats);
|
|
|
|
}
|
2023-09-14 00:37:40 +08:00
|
|
|
};
|
|
|
|
export default closePrivateChat;
|