only show one status if the thread is not cached
This commit is contained in:
parent
25dfb99bb4
commit
217aca3d31
|
@ -86,13 +86,20 @@ async function getStatusThread (instanceName, statusId) {
|
||||||
let keyRange = createThreadKeyRange(statusId)
|
let keyRange = createThreadKeyRange(statusId)
|
||||||
threadsStore.getAll(keyRange).onsuccess = e => {
|
threadsStore.getAll(keyRange).onsuccess = e => {
|
||||||
let thread = e.target.result
|
let thread = e.target.result
|
||||||
let res = new Array(thread.length)
|
if (thread.length) {
|
||||||
thread.forEach((otherStatusId, i) => {
|
let res = new Array(thread.length)
|
||||||
fetchStatus(statusesStore, accountsStore, otherStatusId, status => {
|
callback(res)
|
||||||
res[i] = status
|
thread.forEach((otherStatusId, i) => {
|
||||||
|
fetchStatus(statusesStore, accountsStore, otherStatusId, status => {
|
||||||
|
res[i] = status
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
} else {
|
||||||
callback(res)
|
// thread not cached; just make a "fake" thread with only one status in it
|
||||||
|
fetchStatus(statusesStore, accountsStore, statusId, status => {
|
||||||
|
callback([status])
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue