getPropsForSearchResult: Harden to missing conversation
This commit is contained in:
parent
9f1304bca8
commit
6aedb30905
3 changed files with 26 additions and 7 deletions
|
@ -199,13 +199,15 @@
|
||||||
fromContact.isMe = true;
|
fromContact.isMe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const conversation = this.getConversation();
|
const convo = this.getConversation();
|
||||||
let to = this.findAndFormatContact(conversation.get('id'));
|
|
||||||
if (conversation.isMe()) {
|
let to = convo ? this.findAndFormatContact(convo.get('id')) : {};
|
||||||
|
|
||||||
|
if (convo && convo.isMe()) {
|
||||||
to.isMe = true;
|
to.isMe = true;
|
||||||
} else if (
|
} else if (
|
||||||
sourceE164 === conversation.get('e164') ||
|
(sourceE164 && convo && sourceE164 === convo.get('e164')) ||
|
||||||
sourceUuid === conversation.get('uuid')
|
(sourceUuid && convo && sourceUuid === convo.get('uuid'))
|
||||||
) {
|
) {
|
||||||
to = {
|
to = {
|
||||||
isMe: true,
|
isMe: true,
|
||||||
|
@ -213,7 +215,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
from: fromContact,
|
from: fromContact || {},
|
||||||
to,
|
to,
|
||||||
|
|
||||||
isSelected: this.isSelected,
|
isSelected: this.isSelected,
|
||||||
|
|
|
@ -230,3 +230,20 @@
|
||||||
/>
|
/>
|
||||||
</util.LeftPaneContext>
|
</util.LeftPaneContext>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Empty
|
||||||
|
|
||||||
|
```jsx
|
||||||
|
<util.LeftPaneContext theme={util.theme}>
|
||||||
|
<MessageSearchResult
|
||||||
|
from={{}}
|
||||||
|
to={{}}
|
||||||
|
snippet="What's <<left>>going<<right>> on?"
|
||||||
|
id="messageId1"
|
||||||
|
conversationId="conversationId1"
|
||||||
|
sentAt={Date.now() - 24 * 60 * 1000}
|
||||||
|
onClick={result => console.log('onClick', result)}
|
||||||
|
i18n={util.i18n}
|
||||||
|
/>
|
||||||
|
</util.LeftPaneContext>
|
||||||
|
```
|
||||||
|
|
|
@ -24,7 +24,7 @@ export class ContactName extends React.Component<Props> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={prefix} dir="auto">
|
<span className={prefix} dir="auto">
|
||||||
<Emojify text={title} />
|
<Emojify text={title || ''} />
|
||||||
{shouldShowProfile ? ' ' : null}
|
{shouldShowProfile ? ' ' : null}
|
||||||
{profileElement}
|
{profileElement}
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue