Skip to content

Commit 62c4e89

Browse files
committed
[[contacts]] problem loading profile data
1 parent be6e15e commit 62c4e89

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

src/core/platforms/nodejs-ssb/ssb.js

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -352,30 +352,38 @@ class NodeJsSSB {
352352
})
353353
}
354354

355-
async profile(feedid) {
356-
let opts = {
357-
id: feedid,
358-
reverse: true,
359-
}
355+
profile(feedid) {
356+
return new Promise((resolve, reject) => {
357+
let opts = {
358+
id: feedid,
359+
reverse: true,
360+
}
360361

361-
let user = {
362-
msgs: [],
363-
about: await this.aboutMessages(feedid, feedid),
364-
}
365-
const pipeline = pipelines.thread.get()
362+
let user = {
363+
msgs: [],
364+
about: {},
365+
}
366366

367-
pull(
368-
sbot.createUserStream(opts),
369-
pull.apply(pull, pipeline),
370-
pull.collect(function (err, data) {
371-
if (err) {
372-
throw err
373-
} else {
374-
user.msgs = data
375-
return user
376-
}
367+
this.aboutMessages(feedid, feedid).then(data => {
368+
user.about = data
369+
370+
const pipeline = pipelines.thread.get()
371+
372+
pull(
373+
sbot.createUserStream(opts),
374+
pull.apply(pull, pipeline),
375+
pull.collect(function (err, data) {
376+
if (err) {
377+
reject(err)
378+
} else {
379+
user.msgs = data
380+
console.log('user', user)
381+
resolve(user)
382+
}
383+
})
384+
)
377385
})
378-
)
386+
})
379387
}
380388

381389
get(id) {

src/packages/contacts/Profile.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
})
4747
4848
aboutPromise = ssb.profile(feed).then(data => {
49+
console.log(data)
4950
lastAbout = data.about.reverse().find(m => {
5051
let a = m.value.content
5152
return a.hasOwnProperty("description")

0 commit comments

Comments
 (0)