Blocking Feature Implementation - #413
Conversation
Signed-off-by: hgkim <hgkim@openerd.com>
…ation and AOP support Signed-off-by: hgkim <hgkim@openerd.com>
… and related services Signed-off-by: hgkim <hgkim@openerd.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request implements a comprehensive blocking feature for user content filtering by introducing custom annotations, serializers, APIs, and caching enhancements while also updating documentation and tests.
- Introduces a new @blockword annotation and accompanying serializer for content filtering.
- Adds API endpoints and services to manage block relationships along with caching and exception handling.
- Updates documentation and test cases to guide usage and integration of the feature.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/application-logging.yml | Adds debug logging for block components. |
| src/main/java/app/bottlenote/support/block/service/BlockService.java | Implements block/unblock logic and caching for block relationships. |
| src/main/java/app/bottlenote/support/block/repository/JpaUserBlockRepository.java | Provides JPA repository methods for block data, including a custom query for mutual blocks. |
| src/main/java/app/bottlenote/global/security/SecurityContextUtil.java | Extends context handling to support testing scenarios via a custom authentication token. |
| src/main/java/app/bottlenote/common/block/serializer/BlockWordSerializer.java | Implements the serializer for @blockword with dynamic user ID extraction via reflection. |
| src/main/java/app/bottlenote/common/block/annotation/BlockWord.java | Defines the custom annotation used to trigger content filtering in JSON serialization. |
| Documentation Files | Update guides and usage examples for the blocking feature, including block implementation and testing instructions. |
Comments suppressed due to low confidence (2)
src/main/java/app/bottlenote/support/block/repository/JpaUserBlockRepository.java:32
- Consider rewriting the query to use an explicit CASE expression (e.g., 'CASE WHEN COUNT(ub) = 2 THEN true ELSE false END') to ensure greater compatibility across JPA providers.
@Query("SELECT COUNT(ub) = 2 FROM userBlock ub " +
BLOCK_FEATURE_USAGE.md:6
- [nitpick] The documentation references a BlockFilter annotation in a different package; update this to reflect the actual annotation location (app.bottlenote.common.block.annotation.BlockWord) to avoid confusion.
- **위치**: `app.bottlenote.global.annotation.BlockFilter`
| Object principal = authentication.getPrincipal(); | ||
|
|
||
| // 테스트 환경에서 TestingAuthenticationToken 지원 | ||
| if (authentication.getClass().getSimpleName().equals("TestingAuthenticationToken")) { |
There was a problem hiding this comment.
[nitpick] Using class name string comparison can be brittle; consider using an 'instanceof' check (if the TestingAuthenticationToken type is accessible) to improve maintainability.
Signed-off-by: hgkim <hgkim@openerd.com>
Signed-off-by: hgkim <hgkim@openerd.com>
…tion Signed-off-by: hgkim <hgkim@openerd.com>
Signed-off-by: hgkim <hgkim@openerd.com>
…pendency injection Signed-off-by: hgkim <hgkim@openerd.com>
Signed-off-by: hgkim <hgkim@openerd.com>
…e tests Signed-off-by: hgkim <hgkim@openerd.com>
Signed-off-by: hgkim <hgkim@openerd.com>
…tems and rename test tasks Signed-off-by: hgkim <hgkim@openerd.com>
…adability Signed-off-by: hgkim <hgkim@openerd.com>
…rder Signed-off-by: hgkim <hgkim@openerd.com>
Signed-off-by: hgkim <hgkim@openerd.com>
|



This pull request introduces a comprehensive blocking feature to the application, enabling user-specific content filtering based on block relationships. Key changes include the implementation of annotations for filtering, a custom serializer for blocked content, and APIs for managing block relationships. Additionally, caching and exception handling have been integrated to optimize and secure the feature.
Blocking Feature Implementation:
BLOCK_FEATURE_USAGE.mdto provide detailed instructions on using the blocking feature, including annotations, AOP aspects, and sample implementations.@BlockWordinsrc/main/java/app/bottlenote/common/block/annotation/BlockWord.javato replace blocked user content with a predefined message during JSON serialization.BlockWordSerializerinsrc/main/java/app/bottlenote/common/block/serializer/BlockWordSerializer.javato handle the logic for blocked content replacement.API and Domain Enhancements:
BlockControllerinsrc/main/java/app/bottlenote/support/block/controller/BlockController.javato support blocking, unblocking, and retrieving blocked user lists.UserBlockentity insrc/main/java/app/bottlenote/support/block/domain/UserBlock.javato represent block relationships in the database.Caching and Testing:
LocalCacheTypeinsrc/main/java/app/bottlenote/global/cache/local/LocalCacheType.javato include caching for blocked users.http/block/차단_필터링_테스트.httpto verify the blocking functionality.Exception Handling:
BlockExceptionandBlockExceptionCodeinsrc/main/java/app/bottlenote/support/block/exceptionto handle block-related errors with appropriate HTTP status codes. [1] [2]Integration with Existing Features:
@BlockWordannotation toreviewContentinReviewInfoandnickNameinUserInfoto filter blocked user content in reviews. [1] [2]