Skip to content

Commit

Permalink
Merge pull request #603 from SomaRasu/110/dislikes-on-likes-page
Browse files Browse the repository at this point in the history
updating code for likes page bug
  • Loading branch information
Powersource authored Feb 21, 2021
2 parents 14b8c08 + 519d0e5 commit 1ad14c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/views/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ");

Expand Down

0 comments on commit 1ad14c7

Please sign in to comment.