feat: fix auth context, profile pic storage#162
Merged
AnkushSarkar10 merged 1 commit intomainfrom Apr 1, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request replaces hardcoded user IDs with a dynamic retrieval of the current user's ID and improves profile picture handling from Firebase storage. Key changes include:
- Replacing all instances of the hardcoded user ID '1' with the getCurrentUserId() helper.
- Adding getCurrentUser and getCurrentUserId functions in the auth module.
- Updating profile picture fetching and habit view logic to better reflect the authenticated user.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/auth/index.tsx | Added new helper functions to retrieve current user data and ID. |
| src/components/modify-habit-entry/modify-entry-modal.tsx | Replaced hardcoded user ID with dynamic current user ID. |
| src/components/habit-card.tsx | Replaced hardcoded user ID with getCurrentUserId() for habit card display. |
| src/app/habits/view-habit.tsx | Updated filtering and UI logic to use the dynamic user ID. |
| src/app/auth/create-edit-profile.tsx | Modified profile creation/edit logic to rely on getCurrentUserId() and improved default image usage. |
| src/api/users/* | Replaced usage of getUserById with getUserWithRelationshipById where applicable and updated user ID acquisition. |
| src/api/notifications/* | Replaced hardcoded user ID with getCurrentUserId() for notifications logic. |
| src/api/habits/* | Updated habit mutations to use the current user's data and getCurrentUserId() instead of a hardcoded ID. |
Comments suppressed due to low confidence (2)
src/api/habits/firebase-mutations.ts:49
- Both displayName and username are set to currentUserData.username; consider using a separate field (e.g., currentUserData.displayName) for displayName to accurately represent user data.
displayName: currentUserData.username,
src/api/habits/firebase-mutations.ts:13
- [nitpick] The import path for getCurrentUserId is inconsistent with other files (which import from '@/core'). Consider using a consistent import path to avoid potential confusion.
import { getCurrentUserId } from '@/core/auth';
6164f3a to
ff4e2dd
Compare
owengretzinger
approved these changes
Mar 30, 2025
ff4e2dd to
2af7b65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Uh oh!
There was an error while loading. Please reload this page.