updating code for likes page bug

This commit is contained in:
Soma 2021-02-13 07:23:26 -08:00
parent a7f0f9ab2c
commit c05023e0dd
2 changed files with 8 additions and 3 deletions

View File

@ -787,9 +787,11 @@ module.exports = ({ cooler, isPublic }) => {
.filter(([, value]) => value === 1)
.map(([key]) => key);
// get an array of voter names, for display on hover
const pendingVoterNames = voters.map((author) =>
models.about.name(author)
// get an array of voter names, for display on hovers
const pendingVoterNames = voters.map(async (author) => ({
name: await models.about.name(author),
key: author
})
);
const voterNames = await Promise.all(pendingVoterNames);
@ -1044,10 +1046,12 @@ module.exports = ({ cooler, isPublic }) => {
);
}),
pull.take(maxMessages),
pull.unique(message => message.value.content.vote.link),
pullParallelMap(async (val, cb) => {
const msg = await post.get(val.value.content.vote.link);
cb(null, msg);
}),
pull.filter((message) => message.value.meta.votes.map(voter => voter.key).includes(feed)),
pull.collect((err, collectedMessages) => {
if (err) {
reject(err);

View File

@ -382,6 +382,7 @@ const post = ({ msg, aside = false }) => {
const likedByNames = msg.value.meta.votes
.slice(0, maxLikedNames)
.map((person) => person.name)
.map((name) => name.slice(0, maxLikedNameLength))
.join(", ");