Fix issues with replies and contacts UI. Broaden reply filter

This commit is contained in:
Bojan Mojsilovic 2023-09-28 17:02:03 +02:00
parent 35b060dc70
commit d48916917f
5 changed files with 27 additions and 4 deletions

View File

@ -24,6 +24,7 @@ const FeedSelect: Component<{ isPhone?: boolean, id?: string}> = (props) => {
};
const selectFeed = (option: FeedOption) => {
const [hex, includeReplies] = option.value?.split('_') || [];
const selector = document.getElementById('defocus');

View File

@ -67,7 +67,7 @@
}
}
.replyingTo {
font-size: 15px;
font-size: 14px;
font-weight: 400;
line-height: 16px;
.label {

View File

@ -27,7 +27,9 @@ const ProfileContact: Component<{
return (
<div id={props.id} class={styles.profileContact}>
<Avatar src={props.profile?.picture} size="sm" />
<A href={`/p/${props.profile?.npub}`}>
<Avatar src={props.profile?.picture} size="sm" />
</A>
<A href={`/p/${props.profile?.npub}`} class={styles.info}>
<div class={styles.profileInfo}>

View File

@ -242,7 +242,7 @@ export const HomeProvider = (props: { children: ContextChildren }) => {
const selectFeed = (feed: PrimalFeed | undefined) => {
if (feed !== undefined && feed.hex !== undefined) {
updateStore('selectedFeed', reconcile(feed ));
updateStore('selectedFeed', reconcile({...feed}));
clearNotes();
fetchNotes(feed.hex , `${APP_ID}`, 0, feed.includeReplies);
}

View File

@ -149,7 +149,27 @@ 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 replyTo = message.tags.find(t => t[0] === 'e' && (t[3] === 'root' || t[3] === 'reply')) ;
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];
if (tag[0] !== 'e') continue;
if (tag[3] === 'reply') {
replyTo = [...tag];
break;
}
if (tag[3] === 'root') {
replyTo = [...tag];
break;
}
replyTo = [...tag];
}
let mentionedNotes: Record<string, PrimalNote> = {};
let mentionedUsers: Record<string, PrimalUser> = {};