fix: use denormalize function for modules for sponsor managed pages#940
fix: use denormalize function for modules for sponsor managed pages#940tomrndom wants to merge 1 commit into
Conversation
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
📝 WalkthroughWalkthroughRefactored sponsor page module transformation logic to delegate to shared utilities. Removed ChangesModule Normalization Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/actions/sponsor-pages-actions.js (1)
205-206:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPass
summitTZthrough the managed-page module normalization path.This save path now calls
normalizePageTemplateModules(entity.modules)without the summit timezone, while the customized-page save path passessummitTZand the reducer denormalizes module deadlines with that timezone. In non-UTC summits, managed-page edits can round-tripupload_deadlineincorrectly.Suggested fix
export const saveSponsorManagedPage = (entity) => async (dispatch, getState) => { const { currentSummitState, currentSponsorState } = getState(); const { currentSummit } = currentSummitState; + const summitTZ = currentSummit.time_zone.name; const { entity: { id: sponsorId } } = currentSponsorState; const accessToken = await getAccessTokenSafely(); @@ if (entity.id) { - const normalizedEntity = normalizeSponsorManagedPageToCustomize(entity); + const normalizedEntity = normalizeSponsorManagedPageToCustomize( + entity, + summitTZ + ); @@ -const normalizeSponsorManagedPageToCustomize = (entity) => { +const normalizeSponsorManagedPageToCustomize = (entity, summitTZ) => { const normalizedEntity = { ...entity, ...normalizeSelectAllField( entity.allowed_add_ons, "apply_to_all_add_ons", "allowed_add_ons" ) }; - normalizedEntity.modules = normalizePageTemplateModules(entity.modules); + normalizedEntity.modules = normalizePageTemplateModules( + entity.modules, + summitTZ + );Also applies to: 300-310
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/actions/sponsor-pages-actions.js` around lines 205 - 206, The managed-page save path is calling normalizeSponsorManagedPageToCustomize(entity) which in turn calls normalizePageTemplateModules(entity.modules) without passing summitTZ, causing module deadlines to be denormalized with the wrong timezone; update normalizeSponsorManagedPageToCustomize (and any other managed-page normalization call sites around the other occurrence at ~300-310) to accept and forward summitTZ into normalizePageTemplateModules (i.e., call normalizePageTemplateModules(entity.modules, summitTZ)) so the same summitTZ used by the customized-page path is used for denormalizing upload_deadline.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/actions/sponsor-pages-actions.js`:
- Around line 205-206: The managed-page save path is calling
normalizeSponsorManagedPageToCustomize(entity) which in turn calls
normalizePageTemplateModules(entity.modules) without passing summitTZ, causing
module deadlines to be denormalized with the wrong timezone; update
normalizeSponsorManagedPageToCustomize (and any other managed-page normalization
call sites around the other occurrence at ~300-310) to accept and forward
summitTZ into normalizePageTemplateModules (i.e., call
normalizePageTemplateModules(entity.modules, summitTZ)) so the same summitTZ
used by the customized-page path is used for denormalizing upload_deadline.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1d99d5b2-8404-4a1e-a24c-d39e3ed3ca79
📒 Files selected for processing (2)
src/actions/sponsor-pages-actions.jssrc/reducers/sponsors/sponsor-page-pages-list-reducer.js
ref: https://app.clickup.com/t/86b9x7fbm
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit