-
Notifications
You must be signed in to change notification settings - Fork 74
show notifications acordingly to selected team #3181
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
WalkthroughThe changes in this pull request primarily focus on the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)apps/web/lib/features/team/team-outstanding-notifications.tsx (4)
The addition of Also applies to: 8-8
The changes correctly implement team context awareness:
Also applies to: 24-25
The task count calculation is properly memoized with the correct dependency, preventing unnecessary recalculations when other parts of the component update.
While the memoization and filtering logic look good, there might be an inconsistency in the date comparison logic. The comment states "Notification will be displayed by next day", but the current implementation includes today's tasks: const isTodayOrBefore = moment(plan.date).isSameOrBefore(moment().endOf('day')); Consider excluding today's tasks to match the intended behavior: -const isTodayOrBefore = moment(plan.date).isSameOrBefore(moment().endOf('day'));
+const isBeforeToday = moment(plan.date).isBefore(moment().startOf('day')); Let's verify the intended behavior: 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: 2
🧹 Outside diff range and nitpick comments (1)
apps/web/lib/features/team/team-outstanding-notifications.tsx (1)
55-58
: Consider if memoization is necessary for simple calculations
The memoization of outStandingTasksCount
might be unnecessary overhead for this simple calculation. Consider removing it unless profiling shows performance benefits.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- apps/web/lib/features/team/team-outstanding-notifications.tsx (4 hunks)
🔇 Additional comments (1)
apps/web/lib/features/team/team-outstanding-notifications.tsx (1)
2-2
: Verify team-specific data filtering in getAllDayPlans
The switch from getEmployeeDayPlans
to getAllDayPlans
broadens the data scope. Ensure that getAllDayPlans
properly filters data for the selected team to prevent showing notifications from other teams.
Also applies to: 19-20
✅ Verification successful
Team filtering is properly implemented in getAllDayPlans
The implementation correctly filters data by team through the organizationTeamId
parameter, which is passed from both client and server implementations. The switch from getEmployeeDayPlans
to getAllDayPlans
maintains proper team scope as:
- Client-side API uses the active team ID:
'where[organizationTeamId]': activeTeamId || organizationTeamIdCookie
- Server-side request requires
organizationTeamId
as a mandatory parameter
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for getAllDayPlans implementation to verify team filtering
ast-grep --pattern 'const getAllDayPlans = $_ => {
$$$
}'
Length of output: 61
Script:
#!/bin/bash
# Let's try different approaches to find getAllDayPlans implementation
# Search for getAllDayPlans in any context
rg "getAllDayPlans" -A 5
# Search for files containing DayPlan related code
fd -e ts -e tsx | xargs rg "DayPlan" -l
# Search specifically in hooks directory since it's imported from @app/hooks
fd -e ts -e tsx -p "hooks" | xargs rg "getAllDayPlans"
Length of output: 12625
Script:
#!/bin/bash
# Let's check the implementation of getAllDayPlansAPI to verify team filtering
rg -A 10 "export function getAllDayPlansAPI" apps/web/app/services/client/api/daily-plan.ts
# Also check the server-side implementation
rg -A 10 "export function getAllDayPlans" apps/web/app/services/server/requests/daily-plan.ts
Length of output: 919
Description
Please include a summary of the changes and the related issue.
Type of Change
Checklist
Previous screenshots
Please add here videos or images of previous status
Current screenshots
Please add here videos or images of previous status
Summary by CodeRabbit
New Features
Performance Improvements
These changes enhance the user experience by providing more comprehensive data and improving the performance of notifications related to team tasks.