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 // Add active user's feed if it's missing
// @ts-ignore // @ts-ignore
if (initFeeds && !initFeeds.find(f => f.hex === feedLatest.hex)) { if (initFeeds && !initFeeds.find(f => f.hex === feedLatest.hex)) {
console.log('FIND LATEST')
addAvailableFeed(feedLatest, true, true); addAvailableFeed(feedLatest, true, true);
} }
// Add active user's feed if it's missing // Add active user's feed if it's missing
// @ts-ignore // @ts-ignore
if (initFeeds && !initFeeds.find(f => f.hex === feedLatestWithReplies.hex && feedLatestWithReplies.includeReplies)) { if (initFeeds && !initFeeds.find(f => f.hex === feedLatestWithReplies.hex && feedLatestWithReplies.includeReplies)) {
console.log('FIND REPLIES')
addAvailableFeed(feedLatestWithReplies, true, true); 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 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; let replyTo: string[] | undefined;
// Determine parent by finding the `e` tag with `reply` then `root` as `marker` // Determine parent by finding the `e` tag with `reply` then `root` as `marker`
// If both fail return the last `e` tag // If both fail return the last `e` tag
for (let i=0; i<message.tags.length; i++) { for (let i=0; i<msg.tags.length; i++) {
const tag = message.tags[i]; const tag = msg.tags[i];
if (tag[0] !== 'e') continue; if (tag[0] !== 'e') continue;
@ -251,7 +253,7 @@ export const convertToNotes: ConvertToNotes = (page) => {
noteId: nip19.noteEncode(msg.id), noteId: nip19.noteEncode(msg.id),
noteActions: (page.noteActions && page.noteActions[msg.id]) ?? noActions, noteActions: (page.noteActions && page.noteActions[msg.id]) ?? noActions,
}, },
repost: message.kind === Kind.Repost ? getRepostInfo(page, message) : undefined, repost,
msg, msg,
mentionedNotes, mentionedNotes,
mentionedUsers, mentionedUsers,