-
Notifications
You must be signed in to change notification settings - Fork 304
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
Communication
: Fix an issue with unread message count
#10245
Communication
: Fix an issue with unread message count
#10245
Conversation
|
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 PMD (7.8.0)src/main/java/de/tum/cit/aet/artemis/communication/repository/conversation/ConversationRepository.java[ERROR] Error at ruleset.xml:58:5 59| 67| 72| 76| 79| 80| 82| 83| 84| 85| 86| 87| 88| 91| 92| 107| 120| 125| 135| 138| 185| WalkthroughThe repository interface for conversation queries has been updated in the Changes
Suggested labels
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/main/java/de/tum/cit/aet/artemis/communication/repository/conversation/ConversationRepository.java (1)
41-60
: Test Coverage for Modified Query Logic Appears Insufficient
- No dedicated test files (e.g., ConversationRepositoryTest or ConversationRepositoryIT) were found covering the modified query.
- The repository methods are only indirectly invoked via the ConversationService, leaving a gap in directly verifying that own messages are being excluded.
- It is recommended to add explicit tests to validate the query logic change.
🔗 Analysis chain
Verify test coverage for the modified queries.
The query logic has been modified to exclude own messages. Let's verify the test coverage for these changes.
Run the following script to check for test files:
Also applies to: 80-93
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check test coverage for modified repository methods # Search for test files echo "Searching for test files..." fd -e java "ConversationRepository(Test|IT).java" # Search for test methods echo -e "\nSearching for test methods..." rg -A 5 "getUserInformationForConversations|userHasUnreadMessageInCourse" --type javaLength of output: 4075
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/de/tum/cit/aet/artemis/communication/repository/conversation/ConversationRepository.java
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/communication/repository/conversation/ConversationRepository.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
src/main/java/de/tum/cit/aet/artemis/communication/repository/conversation/ConversationRepository.java (3)
23-25
: LGTM! Repository interface structure follows best practices.The interface is properly structured with correct annotations and follows Java coding guidelines.
55-55
: LGTM! Query modification correctly excludes own messages.The added condition
p.author.id <> :userId
properly addresses the issue of counting own messages towards unread amount while maintaining query performance.
87-87
: LGTM! Query modification correctly excludes own messages from unread count.The added condition
p.author.id <> :userId
properly addresses the issue while maintaining query performance and following SQL guidelines.
...ava/de/tum/cit/aet/artemis/communication/repository/conversation/ConversationRepository.java
Show resolved
Hide resolved
|
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.
great job! I sent messages on random channels and switched between them, and I no longer encounter this issue as before.
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.
Tested on TS4. Works as expected
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.
Tested on TS4. Works as expected, could not reproduce the original bug
Communication
: Fix issue that counts own messages towards unread amountCommunication
: Fix an issue with unread message count
Checklist
General
Server
Motivation and Context
Currently, when composing a message in a channel and quickly switching to another, the message is counted toward the unread message count in that channel. This occurs because the
last_read
column updates asynchronously, leading to a delay in the server's update process. The issue is particularly noticeable on test servers, where the update can take up to 30 seconds to complete.Addresses #10035
Description
I changed the query that counts the posts to not include posts with user id equal to the queried user.
Steps for Testing
Prerequisites:
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.
Review Progress
Code Review
Manual Tests
Summary by CodeRabbit