Skip to content

fix(profile): respect preview mode on the activity pages - #6648

Merged
idoshamun merged 1 commit into
mainfrom
eng-2025-feedback-ux-issue-create-post-button-in-preview-mode-may
Sep 14, 2026
Merged

idoshamun merged 1 commit into
mainfrom
eng-2025-feedback-ux-issue-create-post-button-in-preview-mode-may

Conversation

@idoshamun

@idoshamun idoshamun commented Sep 13, 2026

Copy link
Copy Markdown
Member

Problem

A user with no posts turned on preview mode and was still offered a New post button under activity, reading as if visitors could post on their profile.

The activity section on the profile page itself already handles this — it swaps the owner empty state for the visitor one via useProfilePreview. The hole was one level deeper: the standalone /[userId]/posts, /replies and /upvoted pages compared the logged user to the profile owner directly. The preview toggle lives in ProfileWidgets, which ProfileLayout renders in the aside on those pages too, so toggling preview there left the owner CTAs in place.

Changes

  • pages/[userId]/{posts,replies,upvoted}.tsx take isOwner from useProfilePreview(user) instead of loggedUser?.id === user.id, so preview mode shows the visitor empty state ("… hasn't posted yet" / "hasn't upvoted yet" / "hasn't replied to any post yet") with no owner CTA.
  • getUserPath takes an optional preview flag and the activity tabs pass it, so the Show More links keep ?preview=true rather than silently dropping a previewing owner back into owner mode on the full list.
  • A preview-mode test per page spec. The replies spec needed its own next/router mock (it relied on the global one) and its fixtures updated to current types (socialLinks, numAwards, noindex), which the strict-changed typecheck guard requires once the file is touched.

Key decisions

  • Reused useProfilePreview rather than re-deriving preview state per page, so all profile surfaces read the flag from one place.
  • Carried the preview flag through the activity links: without it the fix only covers toggling preview while already on a subpage, and jumping to the full list quietly exits preview.
  • Left the replies page's comment option menus alone. The activity section suppresses them in preview via hideOptionsMenu; the standalone page does not, but that is a separate preview-fidelity gap from the reported CTA issue.

Verification

  • ProfilePostsPage / ProfileUpvotedPage / ProfileRepliesPage: 12 passed. Reverting posts.tsx makes the new test fail, so it is not vacuous.
  • Full webapp suite: 86 suites / 697 tests passed. Shared profile components: 199 passed.
  • typecheck-strict-changed.js and ESLint clean on all changed files. Full webapp and shared tsc show only pre-existing errors in untouched files.

Closes ENG-2025


Created by Huginn 🐦‍⬛

🤖 Generated with Claude Code

Preview domain

https://eng-2025-feedback-ux-issue-creat.preview.app.daily.dev

The activity section on the profile already swaps the owner empty state
for the visitor one in preview mode, but the standalone posts, replies
and upvoted pages still compared the logged user to the profile owner
directly. The preview toggle lives in the profile sidebar, which renders
on those pages too, so an owner with no posts toggled preview and was
still offered "New post" — reading as if visitors could post on their
profile.

They now take `isOwner` from useProfilePreview, the same source the
activity section uses, and the "Show More" links carry the preview flag
so switching to the full list does not silently leave preview mode.

The replies page spec gained a router mock of its own; its fixtures were
also brought up to the current types, which the strict-changed guard
checks once the file is touched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
daily-webapp Ready Ready Preview Sep 13, 2026 8:40pm UTC

Request Review

@idoshamun
idoshamun merged commit dc7e3b8 into main Sep 14, 2026
11 checks passed
@idoshamun
idoshamun deleted the eng-2025-feedback-ux-issue-create-post-button-in-preview-mode-may branch September 14, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant