Fix reposts showing up as replies

This commit is contained in:
Bojan Mojsilovic 2023-09-28 18:10:00 +02:00
parent d48916917f
commit d470a67cdd
2 changed files with 6 additions and 6 deletions

View File

@ -485,13 +485,11 @@ export const SettingsProvider = (props: { children: ContextChildren }) => {
// Add active user's feed if it's missing
// @ts-ignore
if (initFeeds && !initFeeds.find(f => f.hex === feedLatest.hex)) {
console.log('FIND LATEST')
addAvailableFeed(feedLatest, true, true);
}
// Add active user's feed if it's missing
// @ts-ignore
if (initFeeds && !initFeeds.find(f => f.hex === feedLatestWithReplies.hex && feedLatestWithReplies.includeReplies)) {
console.log('FIND REPLIES')
addAvailableFeed(feedLatestWithReplies, true, true);
}

View File

@ -147,14 +147,16 @@ export const convertToNotes: ConvertToNotes = (page) => {
}
const mentionIds = Object.keys(mentions) //message.tags.reduce((acc, t) => t[0] === 'e' ? [...acc, t[1]] : acc, []);
const userMentionIds = message.tags.reduce((acc, t) => t[0] === 'p' ? [...acc, t[1]] : acc, []);
const userMentionIds = msg.tags.reduce((acc, t) => t[0] === 'p' ? [...acc, t[1]] : acc, []);
const repost = message.kind === Kind.Repost ? getRepostInfo(page, msg) : undefined;
let replyTo: string[] | undefined;
// Determine parent by finding the `e` tag with `reply` then `root` as `marker`
// If both fail return the last `e` tag
for (let i=0; i<message.tags.length; i++) {
const tag = message.tags[i];
for (let i=0; i<msg.tags.length; i++) {
const tag = msg.tags[i];
if (tag[0] !== 'e') continue;
@ -251,7 +253,7 @@ export const convertToNotes: ConvertToNotes = (page) => {
noteId: nip19.noteEncode(msg.id),
noteActions: (page.noteActions && page.noteActions[msg.id]) ?? noActions,
},
repost: message.kind === Kind.Repost ? getRepostInfo(page, message) : undefined,
repost,
msg,
mentionedNotes,
mentionedUsers,