-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: notification count #6109
fix: notification count #6109
Conversation
WalkthroughThe changes in this pull request involve modifications to the notification handling in two main files: Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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
CodeRabbit Configuration File (
|
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 and nitpick comments (2)
apiserver/plane/bgtasks/notification_task.py (2)
2-4
: Remove redundant uuid importThe module-level import
import uuid
is redundant since you're directly importingUUID
from the same module.# Python imports -import uuid +from uuid import UUID -from uuid import UUID
260-260
: Fix line length and improve readabilityThe line exceeds the maximum length of 88 characters. Let's break it into multiple lines for better readability.
- str(mention) for mention in new_mentions if mention in set(project_members) + str(mention) + for mention in new_mentions + if mention in set(project_members)🧰 Tools
🪛 Ruff (0.8.0)
260-260: Line too long (91 > 88)
(E501)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
apiserver/plane/app/views/notification/base.py
(0 hunks)apiserver/plane/bgtasks/notification_task.py
(3 hunks)
💤 Files with no reviewable changes (1)
- apiserver/plane/app/views/notification/base.py
🧰 Additional context used
🪛 Ruff (0.8.0)
apiserver/plane/bgtasks/notification_task.py
260-260: Line too long (91 > 88)
(E501)
comment_mentions = [ | ||
mention | ||
for mention in comment_mentions | ||
if UUID(mention) in set(project_members) | ||
] |
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.
Add error handling for UUID conversion
The UUID conversion could raise a ValueError
for invalid UUIDs. Consider adding error handling to gracefully skip invalid mentions.
comment_mentions = [
mention
for mention in comment_mentions
- if UUID(mention) in set(project_members)
+ if _is_valid_uuid_member(mention, project_members)
]
+def _is_valid_uuid_member(mention, project_members):
+ try:
+ return UUID(mention) in set(project_members)
+ except ValueError:
+ return False
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
comment_mentions = [ | |
mention | |
for mention in comment_mentions | |
if UUID(mention) in set(project_members) | |
] | |
comment_mentions = [ | |
mention | |
for mention in comment_mentions | |
if _is_valid_uuid_member(mention, project_members) | |
] | |
def _is_valid_uuid_member(mention, project_members): | |
try: | |
return UUID(mention) in set(project_members) | |
except ValueError: | |
return False |
fix:
Summary by CodeRabbit
New Features
Bug Fixes
Chores