Avoid processing popular posts twice

Problem: Messages are being fetched with `post.get()`, which runs the
`transform()` function to decorate them with Markdown/etc, but then
they're being passed through `transform()` a second time at the end of
the function. This is inefficient and applies side-effects (like adding
channels to the post) twice.

Solution: Remove the final `transform()` so that these posts are only
decorated once.

Fixes: https://github.com/fraction/oasis/issues/358
This commit is contained in:
Christian Bundy 2020-03-27 09:43:57 -07:00
parent 4883efbc2c
commit 5b2ae2a219
1 changed files with 1 additions and 1 deletions

View File

@ -1065,7 +1065,7 @@ module.exports = ({ cooler, isPublic }) => {
if (err) {
reject(err);
} else {
resolve(transform(ssb, collectedMessages, myFeedId));
resolve(collectedMessages);
}
})
);