From f02db4c93a69cffe8cd01c06bef17cd6d1696ff4 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 12 Oct 2015 17:58:07 +0800 Subject: [PATCH] fix `latestMessageInRealm(:withConversationType:)` --- Yep/Realm/Models.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Yep/Realm/Models.swift b/Yep/Realm/Models.swift index e2e30fb9..e44366f8 100644 --- a/Yep/Realm/Models.swift +++ b/Yep/Realm/Models.swift @@ -559,7 +559,7 @@ func countOfUnreadMessagesInConversation(conversation: Conversation) -> Int { } func latestMessageInRealm(realm: Realm, withConversationType conversationType: ConversationType) -> Message? { - let predicate = NSPredicate(format: "fromFriend != nil AND fromFriend.friendState != %d AND conversation!= nil AND conversation.type = %d", UserFriendState.Me.rawValue, conversationType.rawValue) + let predicate = NSPredicate(format: "fromFriend != nil AND conversation != nil AND conversation.type = %d", conversationType.rawValue) return realm.objects(Message).filter(predicate).sorted("updatedUnixTime", ascending: false).first }