Skip to content

feat: sponsor managed pages delete only for explicits ones#808

Open
tomrndom wants to merge 3 commits intomasterfrom
feature/sponsor-tab-managed-delete
Open

feat: sponsor managed pages delete only for explicits ones#808
tomrndom wants to merge 3 commits intomasterfrom
feature/sponsor-tab-managed-delete

Conversation

@tomrndom
Copy link

@tomrndom tomrndom commented Mar 3, 2026

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

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

Summary by CodeRabbit

  • New Features
    • Users can delete sponsor-managed pages; delete button appears only for explicitly assigned pages and list refreshes after removal.
    • Deletions show a confirmation snackbar and loading state during the operation.
    • Sponsor-managed and customized pages now expose assignment type (Explicit vs. Implicit), support hiding archived items, and allow dynamic ordering and filtering.
    • Table rows respect a deletion-permission check so delete controls only appear when allowed.

@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: 4c890d68-d143-4315-8b00-3c9613e71a02

📥 Commits

Reviewing files that changed from the base of the PR and between fe025dd and b887c85.

📒 Files selected for processing (5)
  • src/actions/sponsor-pages-actions.js
  • src/components/mui/table/mui-table.js
  • src/pages/sponsors/sponsor-pages-tab/index.js
  • src/reducers/sponsors/sponsor-page-pages-list-reducer.js
  • src/utils/constants.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/utils/constants.js
  • src/actions/sponsor-pages-actions.js
  • src/reducers/sponsors/sponsor-page-pages-list-reducer.js

📝 Walkthrough

Walkthrough

Adds deletion support for sponsor-managed pages (new thunk and action type), includes assigned_type in managed/customized page fetches, gates row delete UI via a new canDelete prop and SPONSOR_MANAGED_PAGE_ASSIGNMENT constant, and wires deletion into SponsorPagesTab with list reload and snackbar feedback. (≈36 words)

Changes

Cohort / File(s) Summary
Actions / API
src/actions/sponsor-pages-actions.js
Added SPONSOR_MANAGED_PAGE_DELETED constant and exported deleteSponsorManagedPage(pageId) thunk (DELETE request, dispatches deletion, shows success snackbar, toggles loading). Extended getSponsorManagedPages/getSponsorCustomizedPages to include assigned_type, support is_archived/filter[], and ordering params.
UI Table
src/components/mui/table/mui-table.js
Added canDelete prop (row) => boolean (default () => true) and changed per-row Delete rendering to require canDelete(row) in addition to onDelete.
Feature Integration / Page
src/pages/sponsors/sponsor-pages-tab/index.js
Imported and wired deleteSponsorManagedPage and SPONSOR_MANAGED_PAGE_ASSIGNMENT. Added canDelete predicate (row.assigned_type === SPONSOR_MANAGED_PAGE_ASSIGNMENT.EXPLICIT), call to deleteSponsorManagedPage(itemId) on delete, and reload of managed pages after deletion. Updated mapDispatchToProps to include deleteSponsorManagedPage and getSponsorCustomizedPages.
Constants
src/utils/constants.js
Added SPONSOR_MANAGED_PAGE_ASSIGNMENT = { EXPLICIT: "Explicit", IMPLICIT: "Implicit" }.
Reducer
src/reducers/sponsors/sponsor-page-pages-list-reducer.js
When receiving managed pages, include assigned_type on each page object (shape change to managed page entries).

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant UI as SponsorPagesTab
    participant Table as MuiTable
    participant Action as deleteSponsorManagedPage (Redux)
    participant API as Sponsor Pages API
    participant Store as Redux Store

    User->>Table: Click Delete button on row
    Note over Table,UI: Table renders Delete only if canDelete(row) true (EXPLICIT)
    Table->>UI: handleManagedDelete(itemId)
    UI->>Action: dispatch(deleteSponsorManagedPage(itemId))
    Action->>API: DELETE /sponsor-pages/:pageId
    API-->>Action: 200 OK
    Action->>Store: dispatch(SPONSOR_MANAGED_PAGE_DELETED)
    Store-->>UI: state updated
    UI->>Action: dispatch(getSponsorManagedPages())
    Action->>API: GET /sponsor-pages (fields include assigned_type, may include filter[], ordering)
    API-->>Action: managed pages list
    Action->>Store: update pages list
    Store-->>UI: re-render table
    UI->>User: show success snackbar
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • romanetar

Poem

🐇
I nudged a page off the list with care,
The table winked, the snackbars sang in air,
Explicit hops, implicit stays,
Columns tidy in neat little arrays,
The rabbit twitched and danced without a care.

🚥 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 describes the main change: enabling delete functionality for sponsor-managed pages, with the constraint that only explicit assignments can be deleted.
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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sponsor-tab-managed-delete
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

@tomrndom tomrndom force-pushed the feature/sponsor-tab-managed-delete branch from 68dcf3c to 9cb4626 Compare March 10, 2026 17:49
@tomrndom tomrndom marked this pull request as ready for review March 10, 2026 17:49
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.

🧹 Nitpick comments (2)
src/pages/sponsors/sponsor-pages-tab/index.js (2)

158-171: Move or remove the console.log statement.

The console.log on line 170 executes immediately when handleManagedDelete is called, not after the delete operation completes. If this is for debugging the delete flow, move it inside the .then() block. Otherwise, remove it before merging.

♻️ Suggested fix
   const handleManagedDelete = (itemId) => {
+    console.log("DELETE MANAGED ", itemId); // Move here if debugging is needed
     deleteSponsorManagedPage(itemId).then(() => {
       const { perPage, order, orderDir } = managedPages;
       getSponsorManagedPages(
         term,
         DEFAULT_CURRENT_PAGE,
         perPage,
         order,
         orderDir,
         hideArchived
       );
     });
-    console.log("DELETE MANAGED ", itemId);
   };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/sponsors/sponsor-pages-tab/index.js` around lines 158 - 171, The
console.log in handleManagedDelete runs immediately instead of after the
deletion completes; either remove it or move it into the
deleteSponsorManagedPage(...).then(...) callback so it executes after successful
deletion (or log the error in a .catch()). Update the console.log placement
relative to deleteSponsorManagedPage and getSponsorManagedPages (both referenced
in handleManagedDelete) or delete the console.log entirely before merging.

148-156: Placeholder handlers need implementation before merging.

Several handlers are console.log placeholders:

  • handleArchiveCustomizedPage / handleArchiveManagedPage
  • handleManagedEdit / handleCustomizedEdit
  • handleCustomizedDelete

Since this is WIP, consider adding TODO comments or tracking these in the linked ClickUp task to ensure they're addressed before the final merge.

Also applies to: 173-179

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/sponsors/sponsor-pages-tab/index.js` around lines 148 - 156,
Several handler functions (handleArchiveCustomizedPage,
handleArchiveManagedPage, handleManagedEdit, handleCustomizedEdit,
handleCustomizedDelete) are only console.log placeholders; replace them with
either minimal TODO scaffolding or real implementations: insert a clear TODO
comment with the ClickUp task ID and expected behavior, and either call a shared
utility (e.g., archiveSponsorPage(item, type)) or throw a descriptive "Not
implemented" error so callers fail loudly; ensure signatures remain (item) and
wire the same pattern for the handlers at the other occurrence (lines ~173-179)
so all placeholder handlers are tracked and not left silently no-oping in
production.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/pages/sponsors/sponsor-pages-tab/index.js`:
- Around line 158-171: The console.log in handleManagedDelete runs immediately
instead of after the deletion completes; either remove it or move it into the
deleteSponsorManagedPage(...).then(...) callback so it executes after successful
deletion (or log the error in a .catch()). Update the console.log placement
relative to deleteSponsorManagedPage and getSponsorManagedPages (both referenced
in handleManagedDelete) or delete the console.log entirely before merging.
- Around line 148-156: Several handler functions (handleArchiveCustomizedPage,
handleArchiveManagedPage, handleManagedEdit, handleCustomizedEdit,
handleCustomizedDelete) are only console.log placeholders; replace them with
either minimal TODO scaffolding or real implementations: insert a clear TODO
comment with the ClickUp task ID and expected behavior, and either call a shared
utility (e.g., archiveSponsorPage(item, type)) or throw a descriptive "Not
implemented" error so callers fail loudly; ensure signatures remain (item) and
wire the same pattern for the handlers at the other occurrence (lines ~173-179)
so all placeholder handlers are tracked and not left silently no-oping in
production.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 63a78bc0-36cd-4eb5-9b3e-dff8c252e643

📥 Commits

Reviewing files that changed from the base of the PR and between b29d23f and 9cb4626.

📒 Files selected for processing (4)
  • src/actions/sponsor-pages-actions.js
  • src/components/mui/table/mui-table.js
  • src/pages/sponsors/sponsor-pages-tab/index.js
  • src/utils/constants.js

@tomrndom tomrndom changed the title feat: WIP sponsor managed pages delete only for explicits ones feat: sponsor managed pages delete only for explicits ones Mar 11, 2026
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
Copy link

smarcet commented Mar 16, 2026

@tomrndom please rebase against main and fix conflicts

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-managed-delete branch from fe025dd to b887c85 Compare March 17, 2026 14:04
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