Pretty-ify code. Remove unnecessary comment

This commit is contained in:
Tim Robinson 2020-03-31 00:19:58 -07:00
parent 8cce580008
commit 4884a49dfb
3 changed files with 14 additions and 11 deletions

View File

@ -411,7 +411,7 @@ section > footer > div > form > button.liked {
}
section > footer > div > form > button.like > span.liked-by {
display: none
display: none;
}
section > footer > div > form > button.like:hover {

View File

@ -469,7 +469,9 @@ module.exports = ({ cooler, isPublic }) => {
.map(([key]) => key);
// get an array of voter names, for display on hover
const pendingVoterNames = voters.map((author) => models.about.name(author));
const pendingVoterNames = voters.map((author) =>
models.about.name(author)
);
const voterNames = await Promise.all(pendingVoterNames);
const pendingName = models.about.name(msg.value.author);
@ -1056,13 +1058,12 @@ module.exports = ({ cooler, isPublic }) => {
const adjustedObj = Object.entries(obj).reduce(
(acc, [author, values]) => {
// If the author liked their own content, ignore the vote
if (author === myFeedId) {
return acc;
}
// The value of a users vote is 1 / (1 + total votes), the
// more a user votes, the less weight is given to each vote.
// The value of a users vote is 1 / (1 + total votes), the
// more a user votes, the less weight is given to each vote.
const entries = Object.entries(values);
const total = 1 + Math.log(entries.length);

View File

@ -474,7 +474,7 @@ const post = ({ msg, aside = false }) => {
const maxLikedNameLength = 16;
const maxLikedNames = 20;
const likedBy = msg.value.meta.votes
.slice(0, maxLikedNames)
.map((name) => name.slice(0, maxLikedNameLength))
@ -571,11 +571,13 @@ const post = ({ msg, aside = false }) => {
class: likeButton.class,
},
`${likeCount}`,
span({
class: "liked-by",
},
`Liked by ${likedBy}`)
),
span(
{
class: "liked-by",
},
`Liked by ${likedBy}`
)
)
),
a({ href: url.comment }, i18n.comment),
isPrivate || isRoot || isFork