-
-
Notifications
You must be signed in to change notification settings - Fork 17
Feature/446 comment post saves #450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Removed the CommentSave table and replaced it with a more generic LinkPersonComment table. Adjustments were also made to associated event classes, services, and repositories. Moreover, renamed the CommentSave entity to LinkPersonComment in the database and added a new link_type column. This change allows additional person-comment link types to be handled in the future beyond just saving comments. Signed-off-by: rooki <rooki@rooki.xyz>
CommentSave and PostSave Services, events, and related entities have been refactored and renamed to reflect better usage of "Link" concept. This includes renaming "CommentSaveService" to "LinkPersonCommentService" and "PostSaveService" to "LinkPersonPostService". Functions within these services have also been restructured and properly re-implemented to adhere to new service contracts. Signed-off-by: rooki <rooki@rooki.xyz>
The LinkPersonPostRepository has been moved from the post/repositories directory to person/repositories and associated methods have been updated accordingly. The PostController class has been refactored to handle post links instead of post saves. The LemmyPostService now calculates unread comments based on comment reads and removed state, and updates associated in the PostView model. Other minor changes include code cleanup in LemmyPostReportService and correcting imports in various classes. Signed-off-by: rooki <rooki@rooki.xyz>
The code formatting in the ExpiredRoleScheduler class has been tidied up for better readability. The warning message when the default role is not found has also been updated to indicate that this is expected during the initial application start-up. Signed-off-by: rooki <rooki@rooki.xyz>
…ure/446-comment-post-saves # Conflicts: # src/main/java/com/sublinks/sublinksapi/api/lemmy/v3/post/services/LemmyPostService.java # src/main/resources/db/migration/V20231003__Create_initial_entity_tables.sql # src/main/resources/db/migration/V20231006__Create_foreign_key_references.sql
Refactored link management methods across various services to use streamlined logic and improved consistency. Enhanced database schema with new indices, added support for link events, and optimized persistence calls. Signed-off-by: rooki <rooki@rooki.xyz>
…ure/446-comment-post-saves
…ure/446-comment-post-saves # Conflicts: # src/main/java/com/sublinks/sublinksapi/api/lemmy/v3/community/controllers/CommunityController.java
Switched method arguments and refactored linking logic in multiple services for consistency and improved clarity. Added new deleteLink implementations, adjusted method calls, and updated entity mapping for better maintainability. Signed-off-by: rooki <rooki@rooki.xyz>
…mmentService` Simplify line formatting for conversion calls and improve readability. Added conditional checks to prevent redundant link checks when the creator is an admin or banned in `LemmyCommentService`. Signed-off-by: rooki <rooki@rooki.xyz>
Refactor method to check link between community and person for moderator/owner roles. Improve annotations formatting in controllers to enhance readability. Remove unused repository fields in LemmyCommentService. Signed-off-by: rooki <rooki@rooki.xyz>
Standardize the HttpStatus.UNAUTHORIZED error messages across multiple controllers by changing specific messages like "not_an_admin" and "not_allowed" to a uniform "unauthorized" message. This enhances consistency and simplifies maintenance of error responses. Signed-off-by: rooki <rooki@rooki.xyz>
Improves link management across various services by introducing refresh methods to handle EntityManager updates. Simplifies existing methods and ensures data consistency through immediate persistence and state refresh operations. Signed-off-by: rooki <rooki@rooki.xyz>
Refactored multiple services and repositories to improve code readability and maintainability including formatting for better line breaks. Replaced deprecated refresh logic with streamlined data handling and enhanced method signatures for better context. Signed-off-by: rooki <rooki@rooki.xyz>
Refactored `getPersonPosts` and `getPersonComments` methods to use detailed search criteria. Introduced a `setSavedOnly` method in `PostSearchQueryService` and created `CommentSortTypeSortMapper` for better sorting flexibility. Signed-off-by: rooki <rooki@rooki.xyz>
lazyguru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments, please push back if there are good reasons for keeping the code the way it is.
|
|
||
| logger.warning("Default registered role not found."); | ||
| logger.warning( | ||
| "Default registered role not found. (Expected if it is your initial start of the application.)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there not a way to detect this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really without having another table that has something in it.
src/main/java/com/sublinks/sublinksapi/comment/repositories/CommentReadRepository.java
Outdated
Show resolved
Hide resolved
| public interface LinkPersonCommentRepository extends JpaRepository<LinkPersonComment, Long> { | ||
|
|
||
|
|
||
| Optional<LinkPersonComment> getLinkPersonCommentByCommentAndPersonAndLinkType(Comment comment, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget that Java supports method overloading. Do we really need to have all of these methods have different names? Why not just have getLinkPersonComment and multiple different signatures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is jpa? Or i could of course make custom query with @query but then we will have to do this on every other repository too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something to discuss with @jgrim I think
src/main/java/com/sublinks/sublinksapi/person/services/LinkPersonCommunityService.java
Show resolved
Hide resolved
Replaced method definition with a JPQL query to count comments by person, post, and removed state. Updated the LemmyPostService to call the refactored repository method. Signed-off-by: rooki <rooki@rooki.xyz>
Closes #446