Merge pull request #603 from SomaRasu/110/dislikes-on-likes-page

updating code for likes page bug
This commit is contained in:
Jacob Karlsson 2021-02-21 18:12:09 +01:00 committed by GitHub
commit 1ad14c70d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -787,10 +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);
const { name, avatarId, avatarUrl } = await getUserInfo(
@ -1044,10 +1045,14 @@ 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(", ");