git ssb

2+

mixmix / ticktack



Commit 8b085af93f89fb77c6d8066e7aeb644f24d174eb

fix: broken message subjects will not make ticktack explode.

andre alves garzia committed on 4/23/2018, 4:22:35 PM
Parent: 0a4073c00a2da5c212e6f7ecf45ad96cc8818d14

Files changed

message/html/subject.jschanged
package-lock.jsonchanged
message/html/subject.jsView
@@ -15,9 +15,9 @@
1515 var subjectCache = {}
1616
1717 return nest('message.html.subject', subject)
1818
19- function subject (msg) {
19+ function subject(msg) {
2020 if (msg === undefined) debugger
2121 // test if it's a message ref, or a full message object
2222 // a message ref is generally passed in if we're fetching the subject of a root message
2323 if (isMsg(msg)) {
@@ -26,19 +26,23 @@
2626 var subject = Value()
2727
2828 api.sbot.async.get(msg, (err, value) => {
2929 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+ }
3037
31- var _subject = getMsgSubject({ key: msg, value: api.message.sync.unbox(value) })
32- subject.set(_subject)
33- subjectCache[msg] = _subject
3438 })
3539
3640 return subject
3741 } else { return getMsgSubject(msg) }
3842 }
3943
40- function getMsgSubject (msg) {
44+ function getMsgSubject(msg) {
4145 const { subject, text } = msg.value.content
4246 if (!(subject || text)) return
4347
4448 return subject
package-lock.jsonView
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