Skip to content

Implement post archive feature (ARCHIVED status was orphaned)#1

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/deilusu
Draft

Implement post archive feature (ARCHIVED status was orphaned)#1
Copilot wants to merge 3 commits into
mainfrom
copilot/deilusu

Conversation

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown

PostStatus.ARCHIVED existed in the enum and was counted by AnalyticsService, but had no endpoint, service method, or UI — making it unreachable.

Backend

  • PostService.archivePost() — sets status to ARCHIVED; enforces MANAGER/ADMIN only
  • PATCH /api/posts/{id}/archive@PreAuthorize("hasAnyAuthority('ROLE_MANAGER','ROLE_ADMIN')")

Frontend

  • postsAPI.archivePost(id) → calls the new endpoint
  • archivePostAsync thunk in postsSlice — removes post from items/draftItems and decrements total on fulfillment
  • post:archive permission added to PERMISSIONS map in useRBAC (MANAGER + ADMIN)
  • PostDetailPage: "Archive post" button shown to MANAGER/ADMIN when status === 'PUBLISHED'; text-bg-dark badge for ARCHIVED status

Tests

  • 2 backend integration tests: manager can archive, regular user gets 403
  • 4 frontend tests: slice state transition, RBAC permission checks, button visibility, dispatch call

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 13, 2026 10:01
Co-authored-by: SivaPrasannaS <138652515+SivaPrasannaS@users.noreply.github.com>
Co-authored-by: SivaPrasannaS <138652515+SivaPrasannaS@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with Dei lusu feature Implement post archive feature (ARCHIVED status was orphaned) Mar 13, 2026
Copilot AI requested a review from SivaPrasannaS March 13, 2026 10: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.

2 participants