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

fixed the error while editing admin profile #2282

Conversation

ARYANSHAH1567
Copy link

@ARYANSHAH1567 ARYANSHAH1567 commented Sep 20, 2024

What kind of change does this PR introduce?

Bugfix

Issue Number:

Fixes #1924

It does not give error as CreatorId is being passed to the talawa-api so i will have to change a file in the api also so that it handles it correctly and then it will not throw error
Screenshot 2024-09-21 004048

Summary by CodeRabbit

  • New Features

    • Added a new query to retrieve organizations based on the creator's ID, enhancing data specificity.
    • Renamed existing queries for improved clarity, shifting focus from organizations to members where applicable.
  • Bug Fixes

    • Updated variable naming in the component to align with the new query, ensuring accurate data retrieval based on creator ID.

Copy link

coderabbitai bot commented Sep 20, 2024

Walkthrough

The pull request introduces modifications to several GraphQL queries for improved clarity and functionality. A new query, ORGANIZATIONS_LIST_BY_CREATOR_ID, is added with the signature query OrganizationsByCreator($creatorId: ID!), which retrieves organizations based on a specified creatorId. Existing queries have been renamed for clarity, including MEMBERS_LIST to Members, and others to better reflect their purposes. The LeftDrawerOrg component is updated to use the new creatorId variable, ensuring consistency across the codebase.

Changes

Files Change Summary
src/GraphQl/Queries/Queries.ts Added query OrganizationsByCreator($creatorId: ID!). Renamed queries: Organizations($id: ID!) to Members($id: ID!), Organizations(...) to BlockedMembers(...), Organizations(...) to OrganizationMembers(...).
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx Updated useQuery variable from id to creatorId in the component.

Assessment against linked issues

Objective Addressed Explanation
No visible error when editing Super Admin profile (#[1924]) The changes do not address the error mentioned.

Possibly related PRs

  • fixed the eslint checker #2318: The changes in the main PR regarding the GraphQL queries and their signatures are related to the adjustments made in the LeftDrawerOrg component, which reflects the updated query variables, specifically changing orgId to creatorId.

Suggested reviewers

  • palisadoes

🐇 In the code where creators dwell,
A new ID rings a clearer bell.
From id to creatorId we leap,
For organizations, the data we keep.
A hop, a skip, a query refined,
In the world of code, all aligned! 🐇✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

Copy link

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 01ef5c6 and 4a8fd48.

Files selected for processing (2)
  • src/GraphQl/Queries/Queries.ts (1 hunks)
  • src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (1 hunks)
Additional comments not posted (1)
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (1)

54-54: Verify if the GraphQL query accepts the creatorId parameter.

The variable name in the useQuery hook has been changed from id to creatorId. Please ensure that the corresponding GraphQL query (ORGANIZATIONS_LIST) has been updated to accept the creatorId parameter.

Run the following script to verify the GraphQL query:

Verification successful

The GraphQL query has been correctly updated to accept the creatorId parameter.

The ORGANIZATIONS_LIST query in src/GraphQl/Queries/Queries.ts has been modified to use creatorId instead of id, which aligns with the change in the LeftDrawerOrg component. The import statement in the component file also confirms that it's using the updated query. This change is consistent and should work as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the `ORGANIZATIONS_LIST` query accepts the `creatorId` parameter.

# Test: Search for the `ORGANIZATIONS_LIST` query. Expect: The query should accept the `creatorId` parameter.
rg --type graphql -A 5 $'query ORGANIZATIONS_LIST'

Length of output: 83


Script:

#!/bin/bash
# Description: Locate the ORGANIZATIONS_LIST query and verify if it accepts the creatorId parameter

# Search for the ORGANIZATIONS_LIST query in all file types
echo "Searching for ORGANIZATIONS_LIST query:"
rg -i "query ORGANIZATIONS_LIST" -A 10

# If not found, search for potential .gql files
echo -e "\nSearching for .gql files:"
fd -e gql

# Search for potential GraphQL query definitions in TypeScript files
echo -e "\nSearching for GraphQL query definitions in TypeScript files:"
rg -t ts "gql`\s*query ORGANIZATIONS_LIST" -A 10

Length of output: 440


Script:

#!/bin/bash
# Description: Broader search for ORGANIZATIONS_LIST query and GraphQL definitions

# Search for partial matches of ORGANIZATIONS_LIST
echo "Searching for partial matches of ORGANIZATIONS_LIST:"
rg -i "ORGANIZATIONS_LIST" -A 10

# Search for GraphQL query definitions more broadly
echo -e "\nSearching for GraphQL query definitions:"
rg "gql`|gql\(|graphql`" -A 10

# List relevant file types that might contain GraphQL queries
echo -e "\nListing relevant file types:"
fd -e ts -e tsx -e js -e jsx

Length of output: 188296

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 20, 2024
@palisadoes
Copy link
Contributor

Please fix the failing tests

@ARYANSHAH1567
Copy link
Author

Fixed the liniting errors now it shall pass the failing test

@ARYANSHAH1567
Copy link
Author

@coderabbitai review

Copy link

coderabbitai bot commented Sep 23, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@palisadoes
Copy link
Contributor

Please fix the failing test

@ARYANSHAH1567
Copy link
Author

Please fix the failing test

@palisadoes to fix the failing tests i need to change a file in the Talawa-api so that i can define the creator id in the types and it can be handled properly.

@palisadoes
Copy link
Contributor

Thanks,

  1. Please focus on the failed Test Application test, not the Introspection.
  2. We can address Introspection later

@ARYANSHAH1567
Copy link
Author

Thanks,

  1. Please focus on the failed Test Application test, not the Introspection.
  2. We can address Introspection later

Without the change in API i cant fix the tests or issue

@ARYANSHAH1567
Copy link
Author

Thanks,

  1. Please focus on the failed Test Application test, not the Introspection.
  2. We can address Introspection later

Without the change in API i cant fix the tests or issue

Can i create a issue in api and fix that first? i guess that would help

@palisadoes
Copy link
Contributor

Thanks,

  1. Please focus on the failed Test Application test, not the Introspection.
  2. We can address Introspection later

Without the change in API i cant fix the tests or issue

Can i create a issue in api and fix that first? i guess that would help

OK

@ARYANSHAH1567
Copy link
Author

Thanks,

  1. Please focus on the failed Test Application test, not the Introspection.
  2. We can address Introspection later

Without the change in API i cant fix the tests or issue

Can i create a issue in api and fix that first? i guess that would help

OK

Created the issue can you please assign it to me

@palisadoes
Copy link
Contributor

  1. What is the new issue number?
  2. This PR is still failing the application tests

@ARYANSHAH1567
Copy link
Author

ARYANSHAH1567 commented Oct 5, 2024

  1. What is the new issue number?
  2. This PR is still failing the application tests
  1. The issue number is 2555 in Talawa-API
  2. In the admin, it is actually sending creatorId to retrieve the organisation from talawa-api but the variable name is orgId and talawa-api is treating it is orgId. So it is unable to fetxh the org data and hence we get error while editing the profile.
    Fixes: In api i will change the files so that it can handle the creatorId and can successfully fetch the organisations and send to the admin
    Once the api is fixed it will no longer fail the tests.
    Can you please assign me the issue with issue number 2555 of API so that i can create pr for it and fix the failing tests

Copy link

This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

@github-actions github-actions bot added the no-pr-activity No pull request activity label Oct 16, 2024
@noman2002
Copy link
Member

@ARYANSHAH1567 Are you still working on this ??

@ARYANSHAH1567
Copy link
Author

@ARYANSHAH1567 Are you still working on this ??

Yes, I have created a issue in api regarding this, once that pr gets merged this issue will automatically be solved

@ARYANSHAH1567
Copy link
Author

@palisadoes fixed all the issues and all tests are successful. So can you please review the pr and merge it

Copy link

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 23d6ccb and c6d2ea1.

📒 Files selected for processing (2)
  • src/GraphQl/Queries/Queries.ts (1 hunks)
  • src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (1 hunks)
🧰 Additional context used

src/GraphQl/Queries/Queries.ts Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 17, 2024
@palisadoes
Copy link
Contributor

Please fix the failing tests

@github-actions github-actions bot removed the no-pr-activity No pull request activity label Oct 18, 2024
Copy link

@coderabbitai coderabbitai bot left a 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)
src/GraphQl/Queries/Queries.ts (2)

339-392: LGTM! New query ORGANIZATIONS_LIST_BY_CREATOR_ID looks good.

The new query effectively addresses the PR objective by allowing filtering of organizations by creatorId. The structure and fields returned are comprehensive and appropriate for the use case.

Consider adding a comment above the query to briefly explain its purpose and usage, which would enhance code readability and maintainability.


Renaming of existing queries not reflected

The old query names (MEMBERS_LIST, ORGANIZATIONS_LIST, BLOCK_PAGE_MEMBER_LIST, ORGANIZATIONS_MEMBER_CONNECTION_LIST) are still present in src/GraphQl/Queries/Queries.ts. Please ensure that all intended query renamings have been correctly implemented.

🔗 Analysis chain

Line range hint 1-393: Verify renaming of existing queries.

The AI summary mentions that several existing queries have been renamed for clarity (e.g., MEMBERS_LIST to Members). However, these changes are not visible in the current diff. Please ensure that all intended query renamings have been implemented correctly.

To confirm the query renaming, please run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for renamed queries in the file

echo "Checking for renamed queries:"
grep -n "query " src/GraphQl/Queries/Queries.ts

echo "Checking for old query names:"
grep -n "MEMBERS_LIST" src/GraphQl/Queries/Queries.ts
grep -n "ORGANIZATIONS_LIST" src/GraphQl/Queries/Queries.ts
grep -n "BLOCK_PAGE_MEMBER_LIST" src/GraphQl/Queries/Queries.ts
grep -n "ORGANIZATIONS_MEMBER_CONNECTION_LIST" src/GraphQl/Queries/Queries.ts

Length of output: 1623

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c6d2ea1 and 1954559.

📒 Files selected for processing (2)
  • src/GraphQl/Queries/Queries.ts (1 hunks)
  • src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (3)
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (2)

3-3: LGTM: Updated import statement for the new query.

The import statement has been correctly updated to use the new ORGANIZATIONS_LIST_BY_CREATOR_ID query. This change aligns with the PR objectives and improves the specificity of the imported query.


Line range hint 18-24: Implement the previously suggested prop updates.

A previous review comment suggested updating the component props to use creatorId instead of orgId. This change has not been implemented yet, but it's crucial for maintaining consistency with the new query structure.

Please implement the following changes as suggested in the previous review:

  1. Update the component's props interface:
export interface InterfaceLeftDrawerProps {
-  orgId: string;
+  creatorId: string;
  targets: TargetsType[];
  hideDrawer: boolean | null;
  setHideDrawer: React.Dispatch<React.SetStateAction<boolean | null>>;
}
  1. Update the component's parameter destructuring:
const leftDrawerOrg = ({
  targets,
-  orgId,
+  creatorId,
  hideDrawer,
  setHideDrawer,
}: InterfaceLeftDrawerProps): JSX.Element => {
  // ...
}
  1. Ensure that all usages of the LeftDrawerOrg component are updated to pass creatorId instead of orgId.

Implementing these changes will ensure consistency across the codebase and prevent potential runtime issues.

Also applies to: 30-35

src/GraphQl/Queries/Queries.ts (1)

Line range hint 1-393: Summary of changes and next steps

  1. The new ORGANIZATIONS_LIST_BY_CREATOR_ID query has been successfully added and addresses the PR objectives.
  2. There's a discrepancy between the AI summary (which mentions renaming of existing queries) and the visible changes in the diff. This needs to be resolved.

Next steps:

  1. Add a brief comment explaining the purpose of the new ORGANIZATIONS_LIST_BY_CREATOR_ID query.
  2. Verify and implement the renaming of existing queries as mentioned in the AI summary, if not already done.
  3. Update the PR description or comments to clarify the status of query renaming if it has been intentionally omitted or deferred.

Please confirm that all intended changes have been implemented and that the PR description accurately reflects the current state of the changes.

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

Successfully merging this pull request may close these issues.

3 participants