Include active quizs.id in the /feed/meet API
This commit is contained in:
parent
791bb1eaf0
commit
8dc1923219
|
@ -31,6 +31,12 @@ module.exports = {
|
|||
filter['attributedTo'] = { $nin : urlblocks }
|
||||
}
|
||||
|
||||
const mquizs = await api.me.getQuizs(apID(res.locals.user.username),
|
||||
{ parseToAccount: false }, { id: 1, from: 1 })
|
||||
var quizActors = {}
|
||||
for (var i in mquizs)
|
||||
quizActors[mquizs[i].from] = mquizs[i]
|
||||
|
||||
const notes = await db.table.objects()
|
||||
.find(filter)
|
||||
.sort({ _id: -1 })
|
||||
|
@ -48,13 +54,18 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
var quizId = null
|
||||
const accountActor = utils.firstIfArray(note.attributedTo)
|
||||
if (Object.keys(quizActors).includes(accountActor))
|
||||
quizId = quizActors[accountActor].id
|
||||
|
||||
results.push({
|
||||
_id: note._id,
|
||||
text: utils.firstIfArray(note.content),
|
||||
date: utils.firstIfArray(note.published),
|
||||
account: await api.accounts.getAccount(
|
||||
utils.firstIfArray(note.attributedTo)
|
||||
),
|
||||
account: await api.accounts.getAccount(accountActor),
|
||||
quiz_id: quizId,
|
||||
tags,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue