Add showing friends in search.

pull/272/head
Mikunj 6 years ago
parent 1f03e04d8c
commit 7387e88c97

@ -433,6 +433,7 @@
},
isOnline: this.isOnline(),
hasNickname: !!this.getNickname(),
isFriend: this.isFriend(),
onClick: () => this.trigger('select', this),
onBlockContact: () => this.block(),

@ -48,6 +48,7 @@ export type ConversationType = {
unreadCount: number;
isSelected: boolean;
isTyping: boolean;
isFriend?: boolean;
};
export type ConversationLookupType = {
[key: string]: ConversationType;

@ -96,16 +96,23 @@ export const _getLeftPaneLists = (
): {
conversations: Array<ConversationType>;
archivedConversations: Array<ConversationType>;
contacts: Array<ConversationType>;
} => {
const values = Object.values(lookup);
const sorted = values.sort(comparator);
const conversations: Array<ConversationType> = [];
const archivedConversations: Array<ConversationType> = [];
const contacts: Array<ConversationType> = [];
const max = sorted.length;
for (let i = 0; i < max; i += 1) {
let conversation = sorted[i];
if (conversation.isFriend) {
contacts.push(conversation);
}
if (!conversation.activeAt) {
continue;
}
@ -124,7 +131,7 @@ export const _getLeftPaneLists = (
}
}
return { conversations, archivedConversations };
return { conversations, archivedConversations, contacts };
};
export const getLeftPaneLists = createSelector(

@ -50,6 +50,8 @@ export const getSearchResults = createSelector(
) => {
return {
contacts: compact(
/*
LOKI: Unsure what signal does with this
state.contacts.map(id => {
const value = lookup[id];
@ -62,6 +64,21 @@ export const getSearchResults = createSelector(
return value;
})
*/
state.conversations.map(id => {
const value = lookup[id];
const friend = value && value.isFriend ? { ...value} : null;
if (friend && id === selectedConversation) {
return {
...friend,
isSelected: true,
};
}
return friend;
})
),
conversations: compact(
state.conversations.map(id => {

Loading…
Cancel
Save