Skip to content
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

Inconsistent User ID Handling in User Data Fetching Functions #2222

Open
6 of 10 tasks
lakshayman opened this issue Oct 23, 2024 · 0 comments
Open
6 of 10 tasks

Inconsistent User ID Handling in User Data Fetching Functions #2222

lakshayman opened this issue Oct 23, 2024 · 0 comments

Comments

@lakshayman
Copy link
Contributor

Issue Description

Inconsistent handling of user ID in user data fetching functions

Expected Behavior

All user data fetching functions should consistently handle the user ID by overriding any existing id field in the user data with the document ID.

Current Behavior

Currently, five functions that fetch user data (fetchUser, fetchUserByIds, fetchPaginatedUsers, getDiscordUsers, and fetchAllUsers) handle the user ID inconsistently. Some may include both the document ID and a potentially conflicting id field from the user data.

Screenshots

N/A

Reproducibility

  • This issue is reproducible
  • This issue is not reproducible

Steps to Reproduce

  1. Examine the following functions in models/users.js:
    • fetchUser
    • fetchUserByIds
    • fetchPaginatedUsers
    • getDiscordUsers
    • fetchAllUsers
  2. Observe how each function handles the user ID when constructing the returned user object.

Severity/Priority

  • Critical
  • High
  • Medium
  • Low

Additional Information

The issue can be resolved by ensuring that in all five functions, the document ID is assigned to the id field after spreading the user data. For example:

return {
  ...userData,
  id: documentId,
};

This approach will ensure that the document ID always overrides any existing id field in the user data.

Checklist

  • I have read and followed the project's code of conduct.
  • I have searched for similar issues before creating this one.
  • I have provided all the necessary information to understand and reproduce the issue.
  • I am willing to contribute to the resolution of this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant