refactor: remove unused e-mail controller#2318
Conversation
## Walkthrough
The dependency tree for the project was updated to version 2.6.112-SNAPSHOT, removing several transitive dependencies related to `commons-validator`. The `AddEmailController` class, which handled contributor email addition and validation, was deleted. Multiple REST controllers had their response media type annotations changed from `APPLICATION_JSON_UTF8_VALUE` to `APPLICATION_JSON_VALUE`. Additionally, the storybook import logic was enhanced to detect more metadata markers in chapter text.
## Changes
| Cohort / File(s) | Change Summary |
|-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| **Dependency Tree Update**<br>`pom-dependency-tree.txt` | Updated dependency tree to 2.6.112-SNAPSHOT; removed transitive dependencies on `commons-validator` and related libraries. |
| **Controller Removal**<br>`src/main/java/ai/elimu/web/content/contributor/AddEmailController.java` | Deleted the `AddEmailController`, which managed contributor email addition, validation, and persistence logic. |
| **REST Controllers Media Type Update**<br>`src/main/java/ai/elimu/rest/v2/applications/ApplicationsRestController.java`, `src/main/java/ai/elimu/rest/v2/content/EmojisRestController.java`, `src/main/java/ai/elimu/rest/v2/content/ImagesRestController.java`, `src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java`, `src/main/java/ai/elimu/rest/v2/content/LettersRestController.java`, `src/main/java/ai/elimu/rest/v2/content/NumbersRestController.java`, `src/main/java/ai/elimu/rest/v2/content/SoundsRestController.java`, `src/main/java/ai/elimu/rest/v2/content/StoryBooksRestController.java`, `src/main/java/ai/elimu/rest/v2/content/VideosRestController.java`, `src/main/java/ai/elimu/rest/v2/content/WordsRestController.java` | Changed `@RequestMapping` annotation `produces` attribute from `MediaType.APPLICATION_JSON_UTF8_VALUE` to `MediaType.APPLICATION_JSON_VALUE` in multiple REST controllers, updating the Content-Type header for JSON responses. |
| **StoryBook Metadata Detection Enhancement**<br>`src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java` | Extended metadata detection in ePUB import by adding checks for "translated by" and Thai phrases to exclude metadata chapters. |
## Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutesNote ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🔇 Additional comments (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pom-dependency-tree.txt (1)
22-22: Consider excludingcommons-lang:2.6; only keepcommons-lang3Both the very old
commons-lang:commons-lang:2.6(line 22) and the modernorg.apache.commons:commons-lang3:3.15.0(line 29) are now on the class-path. They share similar package names (org.apache.commons.lang.*vsorg.apache.commons.lang3.*) but provide overlapping utilities, leading to:• Unnecessary WAR size increase
• Confusion for developers (two different APIs with similar names)
• Risk of accidentally using the deprecated 2.x API in new codeUnless 2.x is required by legacy code you still keep, add an
<exclusion>on the artifact that drags it in (oftencommons-dbcporcommons-csv) and rely solely oncommons-lang3.Also applies to: 29-29
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pom.xmlis excluded by!**/*.xml
📒 Files selected for processing (2)
pom-dependency-tree.txt(1 hunks)src/main/java/ai/elimu/web/content/contributor/AddEmailController.java(0 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/ai/elimu/web/content/contributor/AddEmailController.java
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.
pom-dependency-tree.txt (2)
Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.
Learnt from: jo-elimu
PR: #2312
File: src/main/java/ai/elimu/entity/analytics/LetterSoundLearningEvent.java:19-31
Timestamp: 2025-07-27T03:40:02.040Z
Learning: In the elimu.ai webapp project, the database schema file at src/main/resources/META-INF/jpa-schema-export.sql is auto-generated from JPA entity annotations, so manual updates to this file are not needed when adding new entity fields.
🔇 Additional comments (2)
pom-dependency-tree.txt (2)
116-155: Heavy Selenium stack is oncompilescope – move totestto avoid bloating the WAR
selenium-javaand its ~40 transitive jars (lines 116-155) are markedcompile. Unless the webapp uses Selenium at runtime (rare; it is usually only for integration tests), keep them undertestscope to:• Shrink the deployed artifact dramatically
• Cut startup time & CVE surface area
• Avoid licensing/compliance noise in productionAction: change the dependency in the POM to
<scope>test</scope>and verify nothing in main-src refers to Selenium classes.
1-11: Dependency tree looks clean –commons-validator& friends successfully goneSnapshot bump to
2.6.112-SNAPSHOTno longer listscommons-validator,commons-beanutils,commons-digester, orcommons-logging, confirming the e-mail controller removal eliminated unused baggage. Nice cleanup!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2318 +/- ##
============================================
+ Coverage 17.12% 17.14% +0.01%
+ Complexity 462 461 -1
============================================
Files 261 260 -1
Lines 7741 7730 -11
Branches 897 898 +1
============================================
- Hits 1326 1325 -1
+ Misses 6333 6323 -10
Partials 82 82 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
elimu-ai/wiki#194
Issue Number
Purpose
Technical Details
Testing Instructions
Screenshots
Format Checks
Note
Files in PRs are automatically checked for format violations with
mvn spotless:check.If this PR contains files with format violations, run
mvn spotless:applyto fix them.