Commit 8b085af93f89fb77c6d8066e7aeb644f24d174eb
fix: broken message subjects will not make ticktack explode.
andre alves garzia committed on 4/23/2018, 4:22:35 PMParent: 0a4073c00a2da5c212e6f7ecf45ad96cc8818d14
Files changed
message/html/subject.js | changed |
package-lock.json | changed |
message/html/subject.js | ||
---|---|---|
@@ -15,9 +15,9 @@ | ||
15 | 15 | var subjectCache = {} |
16 | 16 | |
17 | 17 | return nest('message.html.subject', subject) |
18 | 18 | |
19 | - function subject (msg) { | |
19 | + function subject(msg) { | |
20 | 20 | if (msg === undefined) debugger |
21 | 21 | // test if it's a message ref, or a full message object |
22 | 22 | // a message ref is generally passed in if we're fetching the subject of a root message |
23 | 23 | if (isMsg(msg)) { |
@@ -26,19 +26,23 @@ | ||
26 | 26 | var subject = Value() |
27 | 27 | |
28 | 28 | api.sbot.async.get(msg, (err, value) => { |
29 | 29 | if (err) throw err |
30 | + try { | |
31 | + var _subject = getMsgSubject({ key: msg, value: api.message.sync.unbox(value) }) | |
32 | + subject.set(_subject) | |
33 | + subjectCache[msg] = _subject | |
34 | + } catch (n) { | |
35 | + subject.set("broken message") | |
36 | + } | |
30 | 37 | |
31 | - var _subject = getMsgSubject({ key: msg, value: api.message.sync.unbox(value) }) | |
32 | - subject.set(_subject) | |
33 | - subjectCache[msg] = _subject | |
34 | 38 | }) |
35 | 39 | |
36 | 40 | return subject |
37 | 41 | } else { return getMsgSubject(msg) } |
38 | 42 | } |
39 | 43 | |
40 | - function getMsgSubject (msg) { | |
44 | + function getMsgSubject(msg) { | |
41 | 45 | const { subject, text } = msg.value.content |
42 | 46 | if (!(subject || text)) return |
43 | 47 | |
44 | 48 | return subject |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 239110 bytes New file size: 257665 bytes |
Built with git-ssb-web