From 55a1a3b361d7f98b69cac5552a633773bc208289 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 22 Jan 2020 11:48:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DremoveUserConverse?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 并修复了chat state 的类型问题 --- src/shared/redux/actions/chat.ts | 3 ++- src/shared/redux/types/chat.ts | 14 +------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/shared/redux/actions/chat.ts b/src/shared/redux/actions/chat.ts index 38c44a813..e94dfdef0 100644 --- a/src/shared/redux/actions/chat.ts +++ b/src/shared/redux/actions/chat.ts @@ -33,6 +33,7 @@ import { renewableDelayTimer } from '../../utils/timer'; import config from '../../project.config'; import _without from 'lodash/without'; import _isFunction from 'lodash/isFunction'; +import _filter from 'lodash/filter'; import { MsgPayload, ConverseInfo } from '@src/shared/redux/types/chat'; import { TRPGAction } from '../types/__all__'; import { isUserUUID } from '@shared/utils/uuid'; @@ -208,7 +209,7 @@ export const removeUserConverse = (userConverseUUID: string): TRPGAction => { // 在localStorage删除 const userUUID = getState().user.info.uuid; const converses = getState().chat.converses; - const uuids = Object.keys(converses.filter((c) => c.type === 'user')); + const uuids = Object.keys(_filter(converses, (c) => c.type === 'user')); rnStorage.set( getUserConversesHash(userUUID), _without(uuids, userConverseUUID) diff --git a/src/shared/redux/types/chat.ts b/src/shared/redux/types/chat.ts index 46a8e760e..80cc8f948 100644 --- a/src/shared/redux/types/chat.ts +++ b/src/shared/redux/types/chat.ts @@ -43,19 +43,7 @@ type WritingListType = { }; }; -export type ChatStateConverseMsgListItem = { - room: string; - uuid: string; - sender: string; - sender_uuid: string; - to_uuid: string; - type: string; - is_public: boolean; - message: string; - date: number; -}; - -export type ChatStateConverseMsgList = ChatStateConverseMsgListItem[]; +export type ChatStateConverseMsgList = MsgPayload[]; export type ChatStateConverse = { uuid: string;