Skip to content

Add author post management flow with pending-only edits and role-aware visibility - #6

Draft
yankeeDamn with Copilot wants to merge 2 commits into
mainfrom
copilot/update-post-content-as-new-user
Draft

Add author post management flow with pending-only edits and role-aware visibility#6
yankeeDamn with Copilot wants to merge 2 commits into
mainfrom
copilot/update-post-content-as-new-user

Conversation

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Community posting supported create + admin moderation, but lacked an author-side management/update path and had incomplete visibility behavior for unpublished posts. This change adds a full author workflow (track, edit pending content) while aligning UI behavior with role-based access rules.

  • Author lifecycle management

    • Added My Posts dashboard at /posts/mine with grouped pending / published / rejected states.
    • Added author edit screen at /posts/[id]/edit for pending posts only, including image replacement/removal.
    • Extended Firestore service layer with explicit author helpers:
      • getUserPostsByStatuses(...)
      • updateOwnPendingPost(...)
  • Role-aware visibility + navigation

    • Updated post detail page to allow unpublished post access for author/admin while keeping public access limited to published posts.
    • Added contextual status messaging on unpublished post views.
    • Added My Posts entry in navbar for authenticated non-admin users.
  • Submission and onboarding flow

    • Redirected successful sign-in/sign-up to /posts/new to guide first contribution.
    • Redirected successful post creation to /posts/mine so authors can immediately track moderation status.
    • Added clearer submission status feedback during image upload/post submit.
  • Security model alignment

    • Tightened Firestore post update rules so authors editing pending posts cannot mutate immutable/moderation fields (authorId, authorName, createdAt, moderatedBy, moderatedAt, status).
    • Kept moderation transitions (published/rejected) admin-controlled.
  • Documentation updates

    • Updated README with role-based access behavior and the new author workflow (/posts/mine, pending edit policy).
// Author-only pending edit guard (service layer)
if (data.authorId !== authorId) throw new Error("You can only edit your own posts");
if (data.status !== "pending") throw new Error("Only pending posts can be edited");

await updateDoc(postRef, {
  title: updates.title,
  summary: updates.summary,
  content: updates.content,
  imageUrl: updates.imageUrl,
  updatedAt: serverTimestamp(),
});

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
binglish-news Ready Ready Preview, Comment Jul 8, 2026 6:31pm

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.

2 participants