fix: reshared posts should be shown in feed

This commit is contained in:
gosangam
2026-05-31 14:54:48 +05:30
parent 7d76afe102
commit 8a8ce24479
6 changed files with 267 additions and 20 deletions
+19 -17
View File
@@ -8,22 +8,24 @@
* The action row hosts:
* • "Edit profile" link — only on the owner's own profile (via the
* `editHref` prop set by /u/me layout).
* • Reading-settings gear — for every signed-in viewer. It links to
* /u/me/settings (a focused page that mounts ReadingSettings in
* inline mode) rather than opening a popover here. A popover
* triggered from this centred row tends to spill off the left edge
* on narrow viewports, so the page-navigation pattern matches Edit
* Profile and dodges the problem entirely.
* • Reading-settings gear — also owner-only. We use `editHref` as the
* "is this my profile?" signal (the /u/me layout passes it; the
* /u/[handle] layout does not), so the two buttons stay in lockstep
* and visitors on someone else's profile see a clean row with no
* personal-settings affordances. The gear links to /u/me/settings
* (the inline reading-prefs page) rather than opening a popover —
* centred-row popovers tend to spill off the left edge on narrow
* viewports.
*
* Anonymous visitors don't see this row at all — they read SiteHeader's
* popover gear instead.
* Auth users on someone else's profile reach reading settings via the
* sidebar rail on desktop. Anonymous visitors use SiteHeader's mobile
* gear.
*/
import Image from "next/image";
import Link from "next/link";
import { Settings } from "lucide-react";
import { cn } from "@/lib/utils";
import { useAuth } from "@/components/auth/auth-provider";
export function ProfileHeader({
avatarURL,
@@ -38,16 +40,16 @@ export function ProfileHeader({
handle: string;
postCount?: number;
joinedAt?: string;
/** When provided, shows an "Edit profile" CTA below the handle. */
/** When provided, shows an "Edit profile" CTA below the handle AND
* the reading-settings gear. Acts as the canonical "this is my own
* profile" signal across the action row. */
editHref?: string;
}) {
const { user, loading } = useAuth();
// ReadingSettings appears for every authenticated viewer (own profile
// OR someone else's), so an auth user reading a friend's profile can
// still reach theme/palette/font controls. Anonymous viewers fall back
// to SiteHeader's mobile gear.
const showReadingSettings = !loading && !!user;
const showActions = !!editHref || showReadingSettings;
// Both action-row affordances are owner-only and ride on the same
// `editHref` signal — when it's absent we render no action row at
// all, which keeps visitor profile views clean.
const showReadingSettings = !!editHref;
const showActions = !!editHref;
return (
<header className="flex flex-col items-center text-center gap-4 pt-4 pb-6 sm:pt-6 sm:pb-8">
+11 -1
View File
@@ -22,7 +22,7 @@
import Image from "next/image";
import Link from "next/link";
import { ExternalLink } from "lucide-react";
import { ExternalLink, Repeat2 } from "lucide-react";
import type { Post } from "@/lib/social";
import { displaySourceLabel } from "@/lib/source-reference";
import { appendHighlight, hasHighlight } from "@/lib/text-highlight";
@@ -46,6 +46,16 @@ export function PostCard({
return (
<article className="rounded-xl bg-card ring-1 ring-foreground/10 p-5">
{/* Reshare attribution — only on rows the feed owner reshared.
The author block below still shows the original author; this
strip just signals "this is on this feed because it was
reshared," matching the Twitter/X retweet convention. */}
{post.reshared_at ? (
<div className="flex items-center gap-1.5 text-xs text-muted-foreground mb-3">
<Repeat2 className="size-3.5" />
<span>Reshared</span>
</div>
) : null}
{/* Author header — identity on the left, overflow menu on the
right. The menu trigger only renders when there are items to
show (delete for owners, block/report for everyone else), so
+11 -1
View File
@@ -29,7 +29,7 @@
import { useEffect, useRef, useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { ImageIcon } from "lucide-react";
import { ImageIcon, Repeat2 } from "lucide-react";
import { cn } from "@/lib/utils";
import type { Post, PostImage } from "@/lib/social";
import { displaySourceLabel } from "@/lib/source-reference";
@@ -75,6 +75,16 @@ export function PostScrollCard({
id={`post-${post.id}`}
className="rounded-2xl overflow-hidden bg-card ring-1 ring-foreground/10 scroll-mt-20 sm:scroll-mt-24"
>
{/* Reshare attribution — only on rows the feed owner reshared.
The author block below still names the original author; this
strip just signals why the post is in this feed. Matches the
Twitter/X retweet convention. */}
{post.reshared_at ? (
<div className="flex items-center gap-1.5 px-4 pt-3 text-xs text-muted-foreground">
<Repeat2 className="size-3.5" />
<span>Reshared</span>
</div>
) : null}
{/* Author header — identity on the left, three-dot overflow menu
on the right (Delete for author, Block/Report for everyone
else; PostCardMenu hides itself when there are no items). */}