-
Notifications
You must be signed in to change notification settings - Fork 297
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
: Change posting deletion logic to not abort when deconstructing a post
#10073
base: develop
Are you sure you want to change the base?
Communication
: Change posting deletion logic to not abort when deconstructing a post
#10073
Conversation
…ion-when-deconstructing-post
WalkthroughThe pull request focuses on refactoring the Changes
Suggested labels
Suggested reviewers
Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)src/main/webapp/app/shared/metis/posting.directive.ts (1)🔇 Additional comments (3)src/main/webapp/app/shared/metis/posting.directive.ts (3)
Calling "deletePostingWithoutTimeout()" during "ngOnDestroy()" ensures the posting is deleted once the user navigates away. This change matches the PR objective of preventing an unintentional abort when the user leaves early. It's aligned with the desired behavior—no modifications needed.
Introducing "deletePostingWithoutTimeout()" centralizes the logic for deleting answer posts versus regular posts, promoting reusability and code cleanliness. The naming also clearly indicates its function. This adheres to the guidelines (arrow functions aren’t strictly required in this scenario). Implementation is correct as is.
While this direct call to "deletePostingWithoutTimeout()" is intentional once the timer expires, confirm that there’s no needed mechanism for the user to revert the deletion in the remaining time. Currently, once setTimeout fires at line 76, the post is gone. Make sure that’s acceptable per the requirements. ✅ Verification successfulLet me gather more information about the deletion functionality and user interaction mechanisms. Let me search specifically for the deletion functionality and any cancel mechanisms in the posting directive. Based on the code review, I can now generate the final response as I have enough context about the deletion mechanism. The deletion countdown mechanism is intentionally designed without a cancel option. The code shows a deliberate implementation where:
This is a common UX pattern where brief countdown timers are used to prevent accidental deletions while maintaining a streamlined deletion flow. The absence of a cancel mechanism is intentional and acceptable. 🏁 Scripts executedThe following scripts were executed for the analysis: Error: No shell scripts found Script: #!/bin/bash
# First, let's look at the full content of the posting directive to understand the deletion flow
rg -l "deletePostingWithoutTimeout" --type ts
# Then get the content of files containing this method
ast-grep --pattern 'deletePostingWithoutTimeout() {
$$$
}'
# Let's also search for any timeout or timer related code in the same context
rg "setTimeout|clearTimeout" --type ts -B 2 -A 2
# Look for any cancel or revert related functions
rg "cancel|revert|undo" --type ts -B 2 -A 2
Length of output: 66917 Script: #!/bin/bash
# Get the full content of the posting directive to understand the deletion flow
cat src/main/webapp/app/shared/metis/posting.directive.ts
# Look for any cancel-related functions in the same file
rg "cancel|revert|undo|deletePosting" src/main/webapp/app/shared/metis/posting.directive.ts -A 5 -B 5
Length of output: 7754 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
|
Communication
: Change posting deletion logic to not abort when deconstructing a post
Checklist
General
Client
authorities
to all new routes and checked the course groups for displaying navigation elements (links, buttons).Motivation and Context
Proposed by: #9848
Currently when one deletes a message and switches the chat or generally leaves the communication area before the deletion countdown has expired the delete operation gets aborted. In my opinion this should not be the intended behaviour as I as a user expect a message to get deleted when I press the delete button and leave the page.
Description
When the posting gets deconstructed the client now stops the delete timeout and instantly deletes the posting as it would have once the timeout expired
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
Performance Review
Code Review
Manual Tests
Exam Mode Test
Performance Tests
Screenshots
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Refactor