Merge pull request #3941 from urbit/mp/hark/remote-comment-content

hark: fix crash on comments with remote content
This commit is contained in:
matildepark 2020-11-17 18:08:02 -05:00 committed by GitHub
commit eaf86d8e7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -59,7 +59,7 @@ const GraphUrl = ({ url, title }) => (
</Box>
);
const GraphNodeContent = ({ contents, mod, description, index }) => {
const GraphNodeContent = ({ contents, mod, description, index, remoteContentPolicy }) => {
const idx = index.slice(1).split("/");
if (mod === "link") {
if (idx.length === 1) {
@ -67,7 +67,7 @@ const GraphNodeContent = ({ contents, mod, description, index }) => {
return <GraphUrl title={text} url={url} />;
} else if (idx.length === 2) {
const [{ text }] = contents;
return <RichText>{text}</RichText>;
return <RichText remoteContentPolicy={remoteContentPolicy}>{text}</RichText>;
}
return null;
}
@ -76,7 +76,7 @@ const GraphNodeContent = ({ contents, mod, description, index }) => {
return null;
} else if (idx[1] === "2") {
const [{ text }] = contents;
return <RichText>{text}</RichText>;
return <RichText remoteContentPolicy={remoteContentPolicy}>{text}</RichText>;
} else if (idx[1] === "1") {
const [{ text: header }, { text: body }] = contents;
const snippet = getSnippet(body);
@ -123,6 +123,7 @@ const GraphNode = ({
index,
graph,
group,
remoteContentPolicy
}) => {
author = deSig(author);
@ -163,6 +164,7 @@ const GraphNode = ({
mod={mod}
description={description}
index={index}
remoteContentPolicy={remoteContentPolicy}
/>
</Row>
</Col>
@ -181,8 +183,9 @@ export function GraphNotification(props: {
associations: Associations;
contacts: Rolodex;
api: GlobalApi;
remoteContentPolicy: any;
}) {
const { contents, index, read, time, api, timebox } = props;
const { contents, index, read, time, api, timebox, remoteContentPolicy } = props;
const authors = _.map(contents, "author");
const { graph, group } = index;
@ -223,6 +226,7 @@ export function GraphNotification(props: {
index={content.index}
graph={graph}
group={group}
remoteContentPolicy={remoteContentPolicy}
/>
))}
</Col>

View File

@ -142,6 +142,7 @@ export function Notification(props: NotificationProps) {
timebox={props.time}
time={time}
associations={associations}
remoteContentPolicy={props.remoteContentPolicy}
/>
</Wrapper>
);