Fix issue with feedId

This commit is contained in:
Cecilia Lindskog 2021-01-27 10:57:04 +01:00
parent 3c771da8ff
commit 29dcaad89c
2 changed files with 12 additions and 6 deletions

View File

@ -693,8 +693,6 @@ module.exports = ({ cooler, isPublic }) => {
}; };
const getUserInfo = async (feedId) => { const getUserInfo = async (feedId) => {
const id = feedId;
const pendingName = models.about.name(feedId); const pendingName = models.about.name(feedId);
const pendingAvatarMsg = models.about.image(feedId); const pendingAvatarMsg = models.about.image(feedId);
@ -708,9 +706,17 @@ module.exports = ({ cooler, isPublic }) => {
const avatarUrl = `/image/64/${encodeURIComponent(avatarId)}`; const avatarUrl = `/image/64/${encodeURIComponent(avatarId)}`;
return { name, id, avatarId, avatarUrl }; return { name, feedId, avatarId, avatarUrl };
}; };
function getRecipientFeedId(recipient) {
if (typeof recipient === "string") {
return recipient;
} else {
return recipient.link;
}
}
const transform = (ssb, messages, myFeedId) => const transform = (ssb, messages, myFeedId) =>
Promise.all( Promise.all(
messages.map(async (msg) => { messages.map(async (msg) => {
@ -853,8 +859,8 @@ module.exports = ({ cooler, isPublic }) => {
if (isPrivate(msg)) { if (isPrivate(msg)) {
msg.value.meta.recpsInfo = await Promise.all( msg.value.meta.recpsInfo = await Promise.all(
msg.value.content.recps.map((feedId) => { msg.value.content.recps.map((recipient) => {
return getUserInfo(feedId); return getUserInfo(getRecipientFeedId(recipient));
}) })
); );
} }

View File

@ -399,7 +399,7 @@ const post = ({ msg, aside = false }) => {
recpsInfo.forEach(function (recp) { recpsInfo.forEach(function (recp) {
recps.push( recps.push(
a( a(
{ href: `/author/${encodeURIComponent(recp.id)}` }, { href: `/author/${encodeURIComponent(recp.feedId)}` },
img({ class: "avatar", src: recp.avatarUrl, alt: "" }) img({ class: "avatar", src: recp.avatarUrl, alt: "" })
) )
); );