Skip to content

Reduced complexity in the file src/controllers/posts.js#35

Open
alreemt wants to merge 2 commits intoCMU-17313Q:mainfrom
alreemt:fix-posts-redirect-smell
Open

Reduced complexity in the file src/controllers/posts.js#35
alreemt wants to merge 2 commits intoCMU-17313Q:mainfrom
alreemt:fix-posts-redirect-smell

Conversation

@alreemt
Copy link
Copy Markdown

@alreemt alreemt commented Sep 4, 2025

Summary
Refactored the function redirectToPost in src/controllers/posts.js to reduce complexity.

Changes Made
Extracted logic into helper functions (parsePid, maybeAssertActivityPubNote, fetchAccessAndPath, etc.).
Added early returns to simplify flow.

Validation
Ran qlty smells, issue resolved.
Passed npm run lint and npm run test.
Manually tested.

Resolves #14

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.

P1B: Refactor (src/controllers/posts.js:16): Function with high complexity (count = 10): redirectToPost

1 participant