Merge pull request #335 from christianbundy/fix-private-message

Fix crash when linking directly to private message
This commit is contained in:
Christian Bundy 2020-03-24 09:35:01 -07:00 committed by GitHub
commit f64a512e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 8 deletions

View File

@ -1052,17 +1052,22 @@ module.exports = ({ cooler, isPublic }) => {
debug("getting root ancestor of %s", msg.key);
if (typeof msg.value.content === "string") {
debug("private message");
// Private message we can't decrypt, stop looking for parents.
resolve(parents);
}
if (msg.value.content.type !== "post") {
debug("private message");
if (parents.length > 0) {
// If we already have some parents, return those.
resolve(parents);
} else {
// If we don't know of any parents, resolve this message.
resolve(msg);
}
} else if (msg.value.content.type !== "post") {
debug("not a post");
resolve(msg);
}
if (isLooseReply(msg) && ssbRef.isMsg(msg.value.content.fork)) {
} else if (
isLooseReply(msg) &&
ssbRef.isMsg(msg.value.content.fork)
) {
debug("reply, get the parent");
try {
// It's a message reply, get the parent!