Skip to content

feat: add custom sponsor page archive/unarchive functionality#809

Merged
smarcet merged 5 commits intomasterfrom
feature/sponsor-tab-custom-archive
Mar 25, 2026
Merged

feat: add custom sponsor page archive/unarchive functionality#809
smarcet merged 5 commits intomasterfrom
feature/sponsor-tab-custom-archive

Conversation

@tomrndom
Copy link

@tomrndom tomrndom commented Mar 3, 2026

ref: https://app.clickup.com/t/86b8nf9mr

Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com

Summary by CodeRabbit

  • New Features
    • Sponsor customized pages can be archived and unarchived from the UI, with success confirmations shown.
  • Documentation
    • Added localized messages for "customized page archived" and "customized page unarchived" notifications.

@tomrndom tomrndom requested a review from smarcet March 3, 2026 21:14
@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d4cc0e0d-8732-4621-aaea-a1a426e14a20

📥 Commits

Reviewing files that changed from the base of the PR and between 0544618 and d7eaf92.

📒 Files selected for processing (1)
  • src/pages/sponsors/sponsor-pages-tab/index.js

📝 Walkthrough

Walkthrough

Adds archive/unarchive support for sponsor customized pages: new Redux action types and thunks that call PUT/DELETE /archive, reducer cases to update page.is_archived, component wiring to dispatch the thunks and refresh pages, i18n strings, and tests for both flows.

Changes

Cohort / File(s) Summary
Actions & Action Types
src/actions/sponsor-pages-actions.js
Added SPONSOR_CUSTOMIZED_PAGE_ARCHIVED and SPONSOR_CUSTOMIZED_PAGE_UNARCHIVED constants; implemented archiveCustomizedPage(pageId) (PUT /archive) and unarchiveCustomizedPage(pageId) (DELETE /archive) thunks that dispatch actions, show success snackbars, and stop loading.
Component Integration
src/pages/sponsors/sponsor-pages-tab/index.js
Imported and connected archiveCustomizedPage/unarchiveCustomizedPage; updated archive handler to call the appropriate thunk based on item.is_archived and refresh customized pages after the promise resolves.
Reducer
src/reducers/sponsors/sponsor-page-pages-list-reducer.js
Handled SPONSOR_CUSTOMIZED_PAGE_ARCHIVED and SPONSOR_CUSTOMIZED_PAGE_UNARCHIVED by immutably updating the matching page's is_archived flag in customizedPages.pages.
Tests
src/pages/sponsors/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.js
Added mocks for archiveCustomizedPage and unarchiveCustomizedPage, extended default test state with summit info, and added two tests asserting correct thunk calls when archive/unarchive controls are clicked.
Localization
src/i18n/en.json
Added sponsor.pages_tab.customized_page_archived and customized_page_unarchived messages for success snackbars.

Sequence Diagram

sequenceDiagram
    participant User as User (UI)
    participant Component as SponsorPagesTab
    participant Thunk as Redux Thunk
    participant API as API Server
    participant Reducer as Pages Reducer
    participant Store as Redux Store

    User->>Component: Click Archive/Unarchive button
    Component->>Thunk: dispatch archiveCustomizedPage(pageId) or unarchiveCustomizedPage(pageId)
    Thunk->>API: PUT /archive (pageId) or DELETE /archive (pageId)
    API-->>Thunk: success response
    Thunk->>Reducer: dispatch SPONSOR_CUSTOMIZED_PAGE_ARCHIVED or SPONSOR_CUSTOMIZED_PAGE_UNARCHIVED (payload: pageId)
    Thunk->>Component: show success snackbar
    Reducer->>Store: update customizedPages.pages[*].is_archived
    Store-->>Component: updated state -> UI reflects archived status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR 805 — Modifies sponsor customized pages flows (create/edit/get/save) touching the same actions/reducer/component areas.
  • PR 771 — Adds/changes sponsor-pages actions and reducer scaffolding that this PR extends with archive/unarchive.

Suggested reviewers

  • smarcet
  • romanetar

Poem

🐇 I hopped through code to flip a bit of fate,
PUTs and DELETEs to close or open a gate,
Reducer changed flags, the UI danced anew,
Snackbars cheered softly: archived or untrue!
Hooray for sponsor pages — tidy and great.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main objective of the pull request: adding archive/unarchive functionality for custom sponsor pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sponsor-tab-custom-archive

Comment @coderabbitai help to get the list of available commands and usage tips.

@tomrndom tomrndom force-pushed the feature/sponsor-tab-custom-add branch from bda0423 to 9e4d822 Compare March 5, 2026 19:24
@tomrndom tomrndom force-pushed the feature/sponsor-tab-custom-add branch from 9e4d822 to 5c1373e Compare March 17, 2026 13:43
@tomrndom tomrndom force-pushed the feature/sponsor-tab-custom-archive branch from 9a95df7 to b1e7ea0 Compare March 17, 2026 13:59
@smarcet
Copy link

smarcet commented Mar 23, 2026

@tomrndom please review conflicts

@tomrndom tomrndom changed the base branch from feature/sponsor-tab-custom-add to master March 24, 2026 14:21
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom force-pushed the feature/sponsor-tab-custom-archive branch from ce35755 to 0544618 Compare March 24, 2026 14:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/sponsors/sponsor-pages-tab/index.js`:
- Around line 176-179: The handler handleArchiveCustomizedPage currently only
calls archiveCustomizedPage(item.id) or unarchiveCustomizedPage(item.id), which
can leave the UI (especially when hideArchived filter is active) stale; update
the handler to await the archive/unarchive action and then refresh the
customized pages list using the existing list loader (e.g., dispatch or call the
fetch/load function that populates the tab) with the current filters (including
hideArchived) so the row/totals update immediately after the toggle; reference
handleArchiveCustomizedPage, archiveCustomizedPage, unarchiveCustomizedPage and
the hideArchived filter when implementing this change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6ff2a0fb-2bc3-4749-ae15-dd14388c4f47

📥 Commits

Reviewing files that changed from the base of the PR and between f5cedb9 and 0544618.

📒 Files selected for processing (5)
  • src/actions/sponsor-pages-actions.js
  • src/i18n/en.json
  • src/pages/sponsors/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.js
  • src/pages/sponsors/sponsor-pages-tab/index.js
  • src/reducers/sponsors/sponsor-page-pages-list-reducer.js

@@ -18,7 +18,9 @@ import {
RECEIVE_SPONSOR_CUSTOMIZED_PAGES,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomrndom
is_archived not mapped from API response in RECEIVE_SPONSOR_CUSTOMIZED_PAGES

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarcet this is mapped at

Copy link

@smarcet smarcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomrndom please review comments

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Copy link

@smarcet smarcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smarcet smarcet merged commit e471e62 into master Mar 25, 2026
9 checks passed
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