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

NoMongo: Postgres Migration Support for POST in orgDashboard #3707

Open
wants to merge 29 commits into
base: develop-postgres
Choose a base branch
from

Conversation

NishantSinghhhhh
Copy link
Contributor

@NishantSinghhhhh NishantSinghhhhh commented Feb 18, 2025

What kind of change does this PR introduce?

This PR introduces a bugfix for the issues found in the OrgPost component and its related GraphQL query.

Issue Number:
Fixes : #3551

Snapshots/Videos:

Screencast.from.2025-02-19.01-57-57.webm

If relevant, did you update the documentation?

N/A

Summary

This PR addresses several issues within the OrgPost component and its GraphQL query:

  1. Corrected the GraphQL query to match the schema and ensure proper data fetching.
  2. Fixed TypeScript errors related to type assignments.
  3. Updated interface names to follow naming conventions.
  4. Removed unused imports and variables.
  5. Ensured proper handling of optional properties in the component.

Does this PR introduce a breaking change?

No

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Other information

N/A

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • Documentation
    • Updated all user-facing documentation for queries, mutations, and components to ensure clarity and cohesion.
    • Added new documentation entries for various GraphQL queries and mutations, including GET_POSTS_BY_ORG and GET_USER_BY_ID.
    • Revised documentation for multiple variables to reflect changes in their definition locations.
  • New Features
    • Introduced an enhanced post display component featuring advanced filtering, sorting, and comprehensive error handling.
    • Added a dedicated search control component to improve post navigation.
    • Implemented new GraphQL queries for retrieving posts by organization and user details by ID.
  • Refactor
    • Streamlined data handling and state management for organization posts, resulting in improved performance.
    • Restructured the OrgPostCard and OrgPost components for better organization and maintainability.
  • Tests
    • Revised component tests for better reliability and clearer user interaction coverage.
    • Updated test cases to align with the new component structure and functionality.

Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Walkthrough

This PR updates multiple documentation files to reflect new definition locations for various GraphQL queries, mutations, and components. It also refactors query and mutation signatures to use consolidated input objects and expands the returned data structures. Significant changes are made to the OrgPost component and its related elements, including new state management for sorting, filtering, and pagination, as well as updates to test cases and interface definitions.

Changes

File(s) Change Summary
docs/docs/auto-docs/GraphQl/Queries/..., docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/..., docs/docs/auto-docs/types/Post/interface/... Updated definition locations for GraphQL variables; added new documentation entries for queries, mutations, interfaces, functions, and components.
src/GraphQl/Queries/OrganizationQueries.ts, src/GraphQl/Queries/Queries.ts Modified query signatures (e.g., renaming Organizations to OrganizationPostList); replaced individual parameters with input objects; added new queries such as GET_POSTS_BY_ORG, FILTERED_ORGANIZATION_POSTS, and GET_USER_BY_ID.
src/GraphQl/Mutations/mutations.ts, src/GraphQl/Mutations/OrganizationMutations.ts Updated mutation signatures to accept a single input object and return extended post data; adjusted variable definition locations.
src/screens/OrgPost/OrgPost.tsx, src/screens/OrgPost/Posts.tsx, src/components/OrgPostCard/OrgPostCard.tsx, src/subComponents/SearchingButton.tsx Refactored component implementations: renamed orgPost to OrgPost, introduced new state management (pagination, sorting, filtering), integrated new query hooks, added PostsRenderer, and improved error handling and UI rendering.
src/components/OrgPostCard/OrgPostCard.spec.tsx, src/screens/OrgPost/OrgPost.spec.tsx Restructured tests by updating mocks, removing redundant cases, and streamlining testing for component rendering and interactions.
src/types/Post/interface.ts Added multiple new interfaces and updated existing ones to enhance type safety and better structure posts, organizations, and mutation inputs.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant O as OrgPost Component
    participant A as Apollo Client
    participant G as GraphQL Server
    participant P as PostsRenderer
    participant C as OrgPostCard

    U->>O: Initiates page load / interaction
    O->>A: Sends GET_POSTS_BY_ORG query
    A->>G: Query request for organization posts
    G-->>A: Returns posts data
    A-->>O: Delivers posts data
    O->>P: Passes data for rendering
    P->>C: Renders individual post cards
    C-->>P: Displays post details
Loading
sequenceDiagram
    participant U as User
    participant C as OrgPostCard
    participant A as Apollo Client
    participant G as GraphQL Server

    U->>C: Click toggle pin on a post
    C->>A: Sends UPDATE_POST mutation with input object
    A->>G: Mutation request for updating post data
    G-->>A: Returns updated post details
    A-->>C: Delivers response
    C-->>U: Updates UI with new post state
Loading

Possibly related PRs

  • Updated user post screen UI #2046: Changes involve updating the documentation for various GraphQL query variables and their definitions, related to the modifications in the retrieved PR that also involve changes to GraphQL mutations and queries, specifically the TOGGLE_PINNED_POST mutation and the addition of new queries like GET_POSTS_BY_ORG.
  • Fix GraphQL Queries related to OrganizationDashboard.jsx #3534: Structural updates to GraphQL queries and documentation, focusing on organization-related data in Queries.ts which align with the current modifications.
  • NoMongo: Postgres Migration Support for POST in orgDashboard #3715: Changes involve updating the documentation for various GraphQL variables and their definition locations in src/GraphQl/Queries/OrganizationQueries.ts, which also involves updates to GraphQL queries and variables in the same file.

Suggested labels

ignore-sensitive-files-pr

Poem

I'm a rabbit on the codebase trail,
Hopping through docs with a nimble tale.
Queries and mutations now dance in line,
Sorting and filtering, oh how they shine!
With a twitch of my nose and a joyful byte,
I celebrate these changes deep into the night.
🐰✨ Happy coding!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

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
Contributor

@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: 4

🧹 Nitpick comments (1)
src/screens/OrgPost/OrgPost.tsx (1)

72-73: Guard or remove console logs in production

Multiple console.log statements are helpful for debugging but can clutter production logs. Consider removing or conditionally wrapping them in a debug flag to keep console output clean.

Also applies to: 83-84, 86-87, 90-91, 99-100, 103-104, 129-130, 137-137, 155-156

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 055f54a and 55cdf39.

📒 Files selected for processing (12)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADMINS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADVERTISEMENT_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_FUNDS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_POST_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_USER_TAGS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_CREATED_ORGANIZATIONS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_JOINED_ORGANIZATIONS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_ORGANIZATION_CONNECTION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/VENUE_LIST.md (1 hunks)
  • docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1 hunks)
  • src/GraphQl/Queries/OrganizationQueries.ts (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (11 hunks)
✅ Files skipped from review due to trivial changes (10)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/VENUE_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_FUNDS.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_CREATED_ORGANIZATIONS.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADMINS_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_ORGANIZATION_CONNECTION.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_JOINED_ORGANIZATIONS.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_POST_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_USER_TAGS_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADVERTISEMENT_LIST.md
  • docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md
🧰 Additional context used
🧠 Learnings (1)
src/GraphQl/Queries/OrganizationQueries.ts (1)
Learnt from: hustlernik
PR: PalisadoesFoundation/talawa-admin#3534
File: src/GraphQl/Queries/Queries.ts:388-395
Timestamp: 2025-02-07T13:00:35.500Z
Learning: The `GET_ORGANIZATION_POSTS_PG` query is designed to fetch only a few recent posts using the `first` parameter, and pagination is intentionally omitted as it's not required for this use case.
🪛 GitHub Actions: PR Workflow
src/screens/OrgPost/OrgPost.tsx

[error] 1-1: No TSDoc comment found in file.

🔇 Additional comments (5)
src/GraphQl/Queries/OrganizationQueries.ts (3)

21-22: Validate acceptance of negative or zero values

Changing $first and $last from a PositiveInt type to a standard Int can allow negative or zero values, potentially causing errors or unexpected behavior. Ensure validation is handled, possibly on the server or in your resolver logic, to safeguard against invalid input.


24-25: Looks good

Using organization(input: $input) aligns with the updated schema. This is a clear and extensible way to handle query parameters in a single input object.


29-32: Consistent field naming

The use of id on both the post and the creator entity is generally fine in GraphQL, as each field is namespaced by its parent object. No issues here.

src/screens/OrgPost/OrgPost.tsx (2)

5-7: Added imports for NotFound and OrgPostCard

Importing dedicated components for empty states and post rendering is a neat approach. This improves modularity.


328-329: Pagination logic is well-structured

Disabling “Next” or “Previous” navigation based on hasNextPage or hasPreviousPage helps prevent invalid pagination requests.

Also applies to: 340-341

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 18, 2025
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
src/screens/OrgPost/OrgPost.tsx (2)

73-109: Add return value documentation to component JSDoc.

The component's JSDoc is comprehensive but lacks information about the return value. Consider adding a @returns tag.

 /**
  * OrgPost Component
  *
  * This component is responsible for rendering and managing organization posts.
  * It allows users to create, view, and navigate through posts associated with an organization.
  *
  * Features:
  * - Fetches and displays organization posts using GraphQL queries.
  * - Supports creating new posts with image/video uploads.
  * - Pagination for navigating between post pages.
  * - Search functionality for filtering posts by title or text.
  * - Sorting options to view the latest or oldest posts.
  * - Allows pinning posts for priority display.
  *
  * Dependencies:
  * - Apollo Client for GraphQL queries and mutations.
  * - React Bootstrap for styling and UI components.
  * - react-toastify for success and error notifications.
  * - i18next for internationalization.
  * - Utility functions like convertToBase64 and errorHandler.
  *
  * Props: None
  *
  * State:
  * - postmodalisOpen: boolean - Controls the visibility of the create post modal.
  * - postformState: object - Stores post form data (title, info, media, pinPost).
  * - sortingOption: string - Stores the current sorting option ('latest', 'oldest').
  * - file: File | null - Stores the selected media file.
  * - after, before: string | null | undefined - Cursor values for pagination.
  * - first, last: number | null - Number of posts to fetch for pagination.
  * - showTitle: boolean - Controls whether to search by title or text.
  *
  * GraphQL Queries:
  * - ORGANIZATION_POST_LIST: Fetches organization posts with pagination.
  * - CREATE_POST_MUTATION: Creates a new post for the organization.
+ *
+ * @returns A JSX element representing the organization posts page with post management functionality.
  */

118-118: Remove debug console.log statements.

Debug console.log statements should not be in production code. Consider using a proper logging framework or removing them.

-  console.log('Page title set to:', t('title'));
-  console.log('Initial post form state:', postformState);
-  console.log('Initial sorting option:', sortingOption);
-  console.log('Current organization ID:', currentUrl);
-  console.log('Opening post modal');
-  console.log('Closing post modal');
-  console.log('Fetched organization posts:', orgPostListData);
-  console.log('Creating post with form state:', postformState);
-  console.log('Post creation response:', data);

Also applies to: 129-129, 132-132, 136-136, 145-145, 150-150, 176-176, 183-183, 212-212

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55cdf39 and eb9a909.

📒 Files selected for processing (21)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md (1 hunks)
  • docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1 hunks)
  • src/GraphQl/Mutations/mutations.ts (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (9 hunks)
✅ Files skipped from review due to trivial changes (18)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md
🧰 Additional context used
🪛 LanguageTool
docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md

[grammar] ~34-~34: The word ‘create’ is a verb. Did you mean the noun “creation”?
Context: ...oolean - Controls the visibility of the create post modal. - postformState: object - S...

(PREPOSITION_VERB)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test Application
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (4)
src/screens/OrgPost/OrgPost.tsx (2)

22-71: Add TSDoc to interfaces.

The interfaces are well-structured but lack documentation. Consider adding TSDoc to improve code maintainability and clarity.

Example:

+/**
+ * Represents a post creator with basic user information.
+ */
 interface InterfacePostCreator {
   id: string;
   firstName?: string;
   lastName?: string;
 }

+/**
+ * Represents a post node with all post-related information.
+ */
 interface InterfacePostNode {
   id: string;
   caption: string;
   text?: string;
   imageUrl?: string | null;
   videoUrl?: string | null;
   creator?: InterfacePostCreator;
   pinned?: boolean;
 }

381-400: Remove unused postID prop.

The postID prop is always passed as an empty string and appears to be unused.

-                    <OrgPostCard
-                      key={post.id}
-                      id={post.id}
-                      postTitle={post.caption}
-                      postInfo={post.text || ''}
-                      postAuthor={`${post.creator?.firstName || ''} ${post.creator?.lastName || ''}`}
-                      postPhoto={post.imageUrl || null}
-                      postVideo={post.videoUrl || null}
-                      pinned={post.pinned || false}
-                      postID={''}
-                    />
+                    <OrgPostCard
+                      key={post.id}
+                      id={post.id}
+                      postTitle={post.caption}
+                      postInfo={post.text || ''}
+                      postAuthor={`${post.creator?.firstName || ''} ${post.creator?.lastName || ''}`}
+                      postPhoto={post.imageUrl || null}
+                      postVideo={post.videoUrl || null}
+                      pinned={post.pinned || false}
+                    />
src/GraphQl/Mutations/mutations.ts (1)

417-429: LGTM! Improved mutation structure.

The updated CREATE_POST_MUTATION follows GraphQL best practices by:

  1. Using a single input object for better type safety
  2. Returning comprehensive post data including attachments
docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1)

1-49: LGTM! Comprehensive documentation.

The documentation is well-structured and provides detailed information about the component's features, dependencies, state management, and GraphQL operations.

🧰 Tools
🪛 LanguageTool

[grammar] ~34-~34: The word ‘create’ is a verb. Did you mean the noun “creation”?
Context: ...oolean - Controls the visibility of the create post modal. - postformState: object - S...

(PREPOSITION_VERB)

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 18, 2025
@palisadoes
Copy link
Contributor

  1. Please make coderabbit.ai approves your work.
  2. Make sure all tests pass and are valid.
  3. Ensure the test code coverage for your patch reaches as close to 100% as possible.

@NishantSinghhhhh
Copy link
Contributor Author

  1. Please make coderabbit.ai approves your work.
  2. Make sure all tests pass and are valid.
  3. Ensure the test code coverage for your patch reaches as close to 100% as possible.

Sure once , I am done restoring the functionality, I will change the tests accordingly

Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

@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: 0

🧹 Nitpick comments (12)
docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS1.md (1)

7-7: Clarify and Document the Union Type Structure

The updated declaration for MOCKS1 now uses a union type to express two distinct payloads. Please verify that these cases accurately represent the intended GraphQL response variations:

  • Case 1: When querying with variables: { id: string; tagId: undefined; userId: undefined; }, the response populates currentUser and leaves unassignUserTag as undefined.
  • Case 2: Conversely, with variables: { id: undefined; tagId: string; userId: string; }, the response populates unassignUserTag (with its _id) and sets currentUser to undefined.

If this distinction is intended, it would be beneficial to add inline comments or consider creating type aliases to improve readability and future maintainability. This can help future developers understand why these two distinct cases exist and how each should be handled in tests.

docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/interfaces/InterfacePostFormNew.md (3)

9-9: Remove Trailing Punctuation in Heading

The heading on this line ends with a colon, which is flagged by markdownlint (MD026). Consider removing the trailing punctuation to comply with style guidelines.

-## CSS Strategy Explanation:
+## CSS Strategy Explanation
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

9-9: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


16-16: Eliminate Trailing Colon in Benefits Heading

The heading "### Benefits:" ends with a colon. Removing this trailing punctuation can improve consistency with markdown style guidelines.

-### Benefits:
+### Benefits
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

16-16: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


21-21: Correct Trailing Punctuation in Global CSS Classes Heading

The heading "### Global CSS Classes used:" includes a trailing colon. Please remove it to align with markdownlint recommendations.

-### Global CSS Classes used:
+### Global CSS Classes used
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

21-21: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/ERROR_MOCK.md (1)

5-7: Variable Declaration Details

The variable ERROR_MOCK is clearly declared with its type (object[]) and is highlighted using markdown formatting. Consider verifying if the escape character in ERROR\_MOCK is necessary for correct rendering; it might be possible to simplify it to ERROR_MOCK.

docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/default.md (1)

12-13: Refactor Sentence Openings for Improved Readability

Both lines 12 and 13 start consecutive sentences with "It". Rephrasing these sentences can enhance the readability of the documentation. For example, you could merge or vary the sentence openings, such as:

-It also allows the user to update the details. It uses the UPDATE_CURRENT_USER_MUTATION to update the user details.
-It uses the CURRENT_USER query to get the user details. It uses the useLocalStorage hook to store the user details in the local storage.
+This component not only displays user details but also enables updates using the UPDATE_CURRENT_USER_MUTATION. Additionally, it retrieves the user information via the CURRENT_USER query and persists these details in local storage through the useLocalStorage hook.

This change helps reduce repetitive sentence structures.

🧰 Tools
🪛 LanguageTool

[style] ~12-~12: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ER_MUTATION to update the user details. It uses the CURRENT_USER query to get the ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~13-~13: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ENT_USER query to get the user details. It uses the useLocalStorage hook to store ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

docs/docs/auto-docs/screens/UserPortal/Settings/ProfileHeader/ProfileHeader/functions/default.md (3)

1-4: Document Header & Introductory Section

The file starts with a clear link ([Admin Docs](/)) and a simple separator. For enhanced clarity, consider including a more descriptive title (for example, “ProfileHeader Default Function Documentation”) to immediately convey the file’s purpose to new readers.


11-19: Component Overview and Layout Description

The overview efficiently explains the purpose of the component along with its layout details. One minor suggestion: for consistency in the bullet lists (specifically, the item “- A profile dropdown menu on the right side”), consider ending the bullet text with a period.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~15-~15: A period might be missing here.
Context: ... - A profile dropdown menu on the right side The layout uses flexbox for proper ali...

(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)


20-35: Parameters & Deprecation Notice Formatting

The parameters are well-described with their types, and the deprecation notice for deprecatedLegacyContext is clearly indicated. However, static analysis flagged that using emphatic markers (e.g., Deprecated and See) as stand-alone headings might not be ideal (MD036). Consider replacing them with proper Markdown headings (for example, ### Deprecated) or stylistically integrating them into the text for better consistency and accessibility.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

30-30: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


32-32: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/UPDATE_MOCK.md (2)

5-10: Variable Declaration and Source Link
The section clearly documents the variable name (UPDATE_MOCK) along with its type (object[]) and provides a direct link to its definition in the source file. Consider verifying whether the escape for the underscore (i.e. UPDATE\_MOCK) is intentional for formatting purposes.


33-144: Result Type Declaration Section
This section is comprehensive and methodically lists all properties of the result.data.updateCurrentUser object with type annotations and default values. The nested subsections (e.g., for addressLine1, avatarMimeType, createdAt, etc.) facilitate easy reference. As a future improvement, consider revisiting the properties typed as any if the schema becomes more stable to provide stronger type safety.

docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCK_FILE.md (1)

7-7: Improve Readability of Complex Type Definition
The complex type structure for MOCK_FILE is presented within a single blockquote, which can affect readability. Consider refactoring this block into a fenced code block with multi-line formatting. For example:

- > `const` **MOCK_FILE**: ({ `request`: { `query`: `DocumentNode`; `variables`: { `id`: `string`; `tagId`: `undefined`; `userId`: `undefined`; }; }; `result`: { `data`: { `currentUser`: { ... }; `unassignUserTag`: `undefined`; }; }; } | { `request`: { `query`: `DocumentNode`; `variables`: { `id`: `undefined`; `tagId`: `string`; `userId`: `string`; }; }; `result`: { `data`: { `currentUser`: `undefined`; `unassignUserTag`: { `_id`: `string`; }; }; }; })[]
+ ```typescript
+ const MOCK_FILE: ({
+   request: { 
+     query: DocumentNode; 
+     variables: { id: string; tagId: undefined; userId: undefined; };
+   };
+   result: {
+     data: {
+       currentUser: { /* detailed properties */ };
+       unassignUserTag: undefined;
+     };
+   };
+ } | {
+   request: {
+     query: DocumentNode;
+     variables: { id: undefined; tagId: string; userId: string; };
+   };
+   result: {
+     data: {
+       currentUser: undefined;
+       unassignUserTag: { _id: string; };
+     };
+   };
+ })[];
+ ```
This change will enable proper syntax highlighting and easier maintenance.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between eb9a909aed880cd0f5ccf1c9b04dd11ba052a54d and c5453818f9f407542de91bade808bfc4c9d37dee.

</details>

<details>
<summary>⛔ Files ignored due to path filters (1)</summary>

* `package-lock.json` is excluded by `!**/package-lock.json`

</details>

<details>
<summary>📒 Files selected for processing (107)</summary>

* `docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/ADD_CUSTOM_FIELD.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/CANCEL_MEMBERSHIP_REQUEST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/JOIN_PUBLIC_ORGANIZATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/REMOVE_CUSTOM_FIELD.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADMIN_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_MEMBER_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_EVENT_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MEMBERSHIP_MUTATION_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_POST_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_EVENT_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ORGANIZATION_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RECAPTCHA_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REFRESH_TOKEN_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_ADMIN_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_MEMBER_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REVOKE_REFRESH_TOKEN.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/SIGNUP_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_CURRENT_USER_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_PASSWORD_MUTATION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/FILTERED_ORGANIZATION_POSTS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADMINS_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADVERTISEMENT_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_FUNDS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_USER_TAGS_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_CREATED_ORGANIZATIONS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_JOINED_ORGANIZATIONS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_ORGANIZATION_CONNECTION.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/VENUE_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/CURRENT_USER.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_ATTENDEES.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_CHECKINS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_DETAILS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_FEEDBACKS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_REGISTRANTS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_DATA_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_MEMBERS_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_COUNT_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_CONNECTION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/RECURRING_EVENTS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_JOINED_ORGANIZATIONS_PG.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_FOR_TABLE.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_REQUEST.md` (1 hunks)
* `docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md` (1 hunks)
* `docs/docs/auto-docs/components/ChangeLanguageDropdown/ChangeLanguageDropDown/functions/default.md` (1 hunks)
* `docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/functions/default.md` (1 hunks)
* `docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/interfaces/InterfacePostFormNew.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/CHAT_BY_ID_QUERY_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/GROUP_CHAT_BY_USER_ID_QUERY_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/MESSAGE_SENT_TO_CHAT_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/UNREAD_CHAT_LIST_QUERY_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/UserConnectionListMock.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/CHATS_LIST_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/CREATE_CHAT_MUTATION_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/GROUP_CHAT_BY_ID_QUERY_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/MARK_CHAT_MESSAGES_AS_READ_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/components/UserPortal/UserProfile/UserAddressFields/functions/UserAddressFields.md` (2 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/default.md` (1 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/getLanguageName.md` (1 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/prettyDate.md` (1 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/ERROR_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS1.md` (1 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS2.md` (3 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS3.md` (3 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCK_FILE.md` (1 hunks)
* `docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/UPDATE_MOCK.md` (1 hunks)
* `docs/docs/auto-docs/screens/UserPortal/Settings/ProfileHeader/ProfileHeader/functions/default.md` (1 hunks)

</details>

<details>
<summary>⛔ Files not processed due to max files limit (21)</summary>

* docs/docs/auto-docs/screens/UserPortal/Settings/ProfileImageSection/ProfileImageSection/functions/default.md
* docs/docs/auto-docs/screens/UserPortal/Settings/Settings/functions/default.md
* docs/docs/auto-docs/screens/UserPortal/Settings/SettingsMocks/variables/MOCKS.md
* docs/docs/auto-docs/screens/UserPortal/Settings/SettingsMocks/variables/MOCKS1.md
* docs/docs/auto-docs/screens/UserPortal/Settings/SettingsMocks/variables/MOCKS2.md
* docs/docs/auto-docs/screens/UserPortal/Settings/SettingsMocks/variables/UPDATE_MOCK.md
* docs/docs/auto-docs/screens/UserPortal/Settings/SettingsMocks/variables/errorMock.md
* docs/docs/auto-docs/screens/UserPortal/Settings/SideToggle/SideToggle/functions/default.md
* docs/docs/auto-docs/screens/UserPortal/Settings/UserDetails/UserDetails/functions/default.md
* docs/docs/auto-docs/utils/formEnumFields/variables/educationGradeEnum.md
* docs/docs/auto-docs/utils/formEnumFields/variables/employmentStatusEnum.md
* docs/docs/auto-docs/utils/formEnumFields/variables/genderEnum.md
* docs/docs/auto-docs/utils/formEnumFields/variables/maritalStatusEnum.md
* docs/docs/auto-docs/utils/passwordValidator/functions/validatePassword.md
* docs/docs/auto-docs/utils/sanitizeAvatar/functions/sanitizeAvatars.md
* docs/docs/auto-docs/utils/urlToFile/functions/urlToFile.md
* src/GraphQl/Mutations/OrganizationMutations.ts
* src/GraphQl/Mutations/mutations.ts
* src/GraphQl/Queries/OrganizationQueries.ts
* src/components/OrgPostCard/OrgPostCard.tsx
* src/screens/OrgPost/OrgPost.tsx

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (72)</summary>

* docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_EVENT_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_ATTENDEES.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_DETAILS.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REFRESH_TOKEN_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_MEMBERS_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/ADD_CUSTOM_FIELD.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_FEEDBACKS.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_MUTATION.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/UserConnectionListMock.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_JOINED_ORGANIZATIONS_PG.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_MEMBER_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/CHAT_BY_ID_QUERY_MOCK.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REVOKE_REFRESH_TOKEN.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/SIGNUP_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_REQUEST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_PASSWORD_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/JOIN_PUBLIC_ORGANIZATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_DATA_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ORGANIZATION_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/CURRENT_USER.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md
* docs/docs/auto-docs/components/ChangeLanguageDropdown/ChangeLanguageDropDown/functions/default.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/CHATS_LIST_MOCK.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_REGISTRANTS.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/MARK_CHAT_MESSAGES_AS_READ_MOCK.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/RECURRING_EVENTS.md
* docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/getLanguageName.md
* docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/REMOVE_CUSTOM_FIELD.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/UNREAD_CHAT_LIST_QUERY_MOCK.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_CHECKINS.md
* docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/prettyDate.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/FILTERED_ORGANIZATION_POSTS.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/GROUP_CHAT_BY_ID_QUERY_MOCK.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_CURRENT_USER_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_MEMBER_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MEMBERSHIP_MUTATION_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_POST_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_PG.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/GROUP_CHAT_BY_USER_ID_QUERY_MOCK.md
* docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/CANCEL_MEMBERSHIP_REQUEST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_ADMIN_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks/variables/MESSAGE_SENT_TO_CHAT_MOCK.md
* docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/functions/default.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_COUNT_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION.md
* docs/docs/auto-docs/components/UserPortal/CreateDirectChat/CreateDirectChatMocks2/variables/CREATE_CHAT_MUTATION_MOCK.md
* docs/docs/auto-docs/components/UserPortal/UserProfile/UserAddressFields/functions/UserAddressFields.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADMIN_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_LIST.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_CONNECTION_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RECAPTCHA_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_FOR_TABLE.md
* docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_EVENT_MUTATION.md

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (26)</summary>

* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_CREATED_ORGANIZATIONS.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_JOINED_ORGANIZATIONS.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_ORGANIZATION_CONNECTION.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADMINS_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_USER_TAGS_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_FUNDS.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADVERTISEMENT_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md
* docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/VENUE_LIST.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md
* docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS1.md (1)</summary>

Learnt from: meetulr
PR: #2355
File: src/screens/ManageTag/ManageTagMocks.ts:187-269
Timestamp: 2024-11-12T10:40:58.654Z
Learning: In src/screens/ManageTag/ManageTagMocks.ts, when mocking data for USER_TAGS_ASSIGNED_MEMBERS and USER_TAGS_MEMBERS_TO_ASSIGN_TO, it's acceptable for user IDs to overlap because the queries serve different purposes and the overlapping IDs can represent realistic scenarios in tests.


</details>

</details><details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/default.md</summary>

[style] ~12-~12: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ER_MUTATION to update the user details. It uses the CURRENT_USER query to get the ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

---

[style] ~13-~13: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ENT_USER query to get the user details. It uses the useLocalStorage hook to store ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

</details>
<details>
<summary>docs/docs/auto-docs/screens/UserPortal/Settings/ProfileHeader/ProfileHeader/functions/default.md</summary>

[uncategorized] ~15-~15: A period might be missing here.
Context: ... - A profile dropdown menu on the right side  The layout uses flexbox for proper ali...

(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCK_FILE.md</summary>

[typographical] ~1-~1: Ikke parret symbol: "]" ser ud til at mangle
Context: [Admin Docs](/)  ***  # Variable: MOCK\_F...

(UNPAIRED_BRACKETS)

</details>

</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

<details>
<summary>docs/docs/auto-docs/screens/UserPortal/Settings/ProfileHeader/ProfileHeader/functions/default.md</summary>

30-30: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

---

32-32: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

</details>
<details>
<summary>docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/interfaces/InterfacePostFormNew.md</summary>

9-9: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

---

16-16: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

---

21-21: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (54)</summary><blockquote>

<details>
<summary>docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/interfaces/InterfacePostFormNew.md (1)</summary>

`1-84`: **Overall Documentation Quality and Clarity**

The new documentation file for `InterfacePostFormNew` is well structured and highly informative. The headings, property descriptions, and direct links to the source code greatly improve clarity and ease of navigation for future developers. Keep up the good work!

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

9-9: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

---

16-16: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

---

21-21: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

</details>

</details>

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/ERROR_MOCK.md (10)</summary>

`1-2`: **Documentation Header and Admin Docs Link**

The header link provides quick navigation to the Admin Docs. Ensure that the relative link (`/`) resolves correctly in all deployment contexts.

---

`3-4`: **Separator Formatting**

The horizontal rule (`***`) is used effectively to separate the header from the content, enhancing readability.

---

`9-10`: **Definition Location Link**

The link that points to the source definition at `src/screens/MemberDetail/MemberDetailMocks.ts:193` is very helpful. Make sure it remains updated if the source file path or line number changes.

---

`11-12`: **Type Declaration Section**

The section clearly labels the type declaration, which organizes the subsequent details in a structured manner.

---

`13-16`: **Error Property Documentation**

The `error` property is documented succinctly as type `Error`. This clear declaration helps in understanding the expected structure of the `ERROR_MOCK` variable.

---

`17-20`: **Request Property Documentation**

The documentation specifies that `request` is of type `object`, setting a good foundation for the nested properties. If the complexity of the structure increases in the future, consider providing additional details.

---

`21-24`: **Request Query Documentation**

The `request.query` property is clearly documented with its type (`DocumentNode`) and its initialization with `UPDATE_CURRENT_USER_MUTATION`. This precise detail aligns well with expected usage in the source code.

---

`25-28`: **Request Variables Documentation**

The property `request.variables` is defined as an `object`. The concise declaration is clear; however, if the variables object grows in complexity, expanding the documentation to include sub-properties might be beneficial.

---

`29-32`: **Input Object Documentation**

The `request.variables.input` property is documented as an object. The nested documentation reinforces the intended structure of the data, which is good for maintainability.

---

`33-35`: **Input Name Property Documentation**

The documentation for `request.variables.input.name` is clear, indicating its type as `string` along with the default value `'Test User'`. This helps in understanding both the type and the initial value.

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetail/functions/default.md (1)</summary>

`9-9`: **Verify Updated Source Reference**

The "Defined in:" link now correctly points to `src/screens/MemberDetail/MemberDetail.tsx:44`, reflecting the updated location of the function definition. Please double‐check that the target file and line number are correct.

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS3.md (3)</summary>

`9-9`: **Confirm Updated Definition Reference**

The "Defined in:" link has been updated to point to `src/screens/MemberDetail/MemberDetailMocks.ts:106`, which aligns with the reorganization in the source file. Please verify that the revised marker accurately reflects the current file structure.

---

`19-19`: **Ensure Correct Query Documentation**

The request object now documents the query as `DocumentNode` with a value of `CURRENT_USER` on line 19. This update is consistent with the PR objectives.

---

`37-143`: **Validate Updated Mock Data Structure for currentUser**

The entire block defining `result.data.currentUser` (from line 37 through line 143) has been comprehensively updated. The renaming from previous user data fields to `currentUser` and the inclusion of new attributes (such as `addressLine1`, `avatarMimeType`, `emailAddress`, etc.) are clear and consistent. Please ensure that these documented fields match the actual GraphQL schema and serve the intended purpose in tests.

</details>
<details>
<summary>docs/docs/auto-docs/screens/UserPortal/Settings/ProfileHeader/ProfileHeader/functions/default.md (4)</summary>

`5-10`: **Function Signature Documentation Clarity**

The documentation clearly presents the function signature (using the blockquote) along with a link to its location in the source code. This format helps developers quickly find the implementation.

---

`36-39`: **Return Type Documentation**

The return type `ReactNode` is clearly listed and easy to understand. No changes are necessary here.

---

`40-46`: **Remarks Section Review**

The remarks section effectively outlines the Bootstrap classes used for layout and styling, which aids in understanding how the component is visually structured. This section is concise and useful.

---

`47-58`: **Example Usage Clarity**

The examples provided for basic usage and usage with translated text are well-formatted using proper code blocks and language markers (`tsx`). These examples will assist developers in quickly implementing the component.

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/UPDATE_MOCK.md (2)</summary>

`1-4`: **General Documentation Header**  
The header with the “[Admin Docs](/)” link and horizontal rule is clear and provides a good starting point for the document.

---

`11-32`: **Request Type Declaration Section**  
The breakdown of the request object—including its properties like `query` (correctly assigned to `UPDATE_CURRENT_USER_MUTATION`) and the nested `variables.input.name` (with its default value)—is structured well. This clear hierarchical presentation should help users quickly understand the expected input format for the GraphQL mutation.

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCK_FILE.md (4)</summary>

`1-2`: **Markdown Link Verification**  
The markdown link `[Admin Docs](/)` is correctly formed. The static analysis warning regarding an unpaired bracket appears to be a false positive.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[typographical] ~1-~1: Ikke parret symbol: "]" ser ud til at mangle
Context: [Admin Docs](/)  ***  # Variable: MOCK\_F...

(UNPAIRED_BRACKETS)

</details>

</details>

---

`3-4`: **Horizontal Rule Confirmation**  
The horizontal rule (`***`) is used appropriately to separate content in the document.

---

`5-6`: **Header and Title Formatting**  
The header `# Variable: MOCK\_FILE` is clear and well-formatted with proper escaping to display the underscore.

---

`9-10`: **Source Reference Link Clarity**  
The reference link to the source file (`src/screens/MemberDetail/MemberDetailMocks.ts:207`) is clear and correctly formatted. Ensure this link is updated if the file path changes in the future.

</details>
<details>
<summary>docs/docs/auto-docs/screens/MemberDetail/MemberDetailMocks/variables/MOCKS2.md (29)</summary>

`9-9`: **Source Link Update**  
The reference now clearly indicates that `MOCKS2` is defined at line 64 in `MemberDetailMocks.ts`. This link improves traceability between the docs and the actual implementation.

---

`19-19`: **GraphQL Query Update**  
The `request.query` now correctly uses `CURRENT_USER`, aligning the mock with the updated GraphQL schema. Ensure that other parts of the system consuming this mock data are updated accordingly.

---

`37-39`: **Result Data Restructure**  
The mock has been updated to use `currentUser` instead of the former nested `user` property. This enhances consistency with the backend response structure.

---

`41-43`: **Typename Definition**  
Defining `__typename` as `'User'` for `currentUser` is in line with GraphQL best practices. Confirm that this value remains consistent across similar queries.

---

`45-47`: **Address Line 1 Field Update**  
The `addressLine1` property is now explicitly defined with the placeholder `'Line 1'`. Verify that this conforms to the expected structure from the backend.

---

`49-51`: **Address Line 2 Field Update**  
The `addressLine2` property has been updated appropriately to `'Line 2'`, matching the new data schema.

---

`53-55`: **Avatar MIME Type Update**  
The `avatarMimeType` field is now included with a sample value `'image/jpeg'`, ensuring consistency in representing media types.

---

`57-59`: **Avatar URL Field**  
The `avatarURL` now points to a placeholder URL. Ensure that this value is updated in real scenarios or tests where an actual URL is needed.

---

`61-63`: **Birth Date Format**  
The `birthDate` field now uses the ISO date string `'2000-01-01'`. Confirm that all date fields across the application adhere to this or an agreed-upon standard format.

---

`65-67`: **City Field Update**  
The property `city` is now set to `'nyc'`. Verify that this shorthand is intentional and consistent with other representations of city names in the system.

---

`69-71`: **Country Code Field**  
The `countryCode` is updated to `'bb'`. Please double-check that this code is correct and not a typographical error.

---

`73-75`: **CreatedAt Timestamp Update**  
The `createdAt` field is now provided with a specific timestamp. Ensure that the format and example value align with production expectations.

---

`77-79`: **Description Field Update**  
The `description` field now includes a placeholder `'This is a description'`. This update should help clarify the intended structure for current user data in mocks.

---

`81-83`: **Education Grade Update**  
The `educationGrade` field is defined with the value `'grade_8'`. Confirm that this sample value is representative and consistent with schema definitions.

---

`85-87`: **Email Address Field**  
The email field now uses `'test221@gmail.com'` as a placeholder. Make sure this is acceptable for testing purpose and does not conflict with any validation rules in the system.

---

`89-91`: **Employment Status Field**  
The `employmentStatus` is updated to `'employed'` to reflect a concrete example test value. Verify that this status is part of the allowed enumeration in the system.

---

`93-95`: **Home Phone Number Update**  
The `homePhoneNumber` field now holds `'+9999999998'`. Confirm that this format matches the expected format across other mock datasets.

---

`97-99`: **User ID Field Update**  
The `id` for `currentUser` has been updated to a UUID-like string. Ensure consistency with how user IDs are represented in the production database.

---

`101-103`: **Email Verification Flag**  
The boolean flag `isEmailAddressVerified` is set to `false`, which is typically the expected default for user creation states.

---

`105-107`: **Marital Status Field**  
The `maritalStatus` field is now defined as `'engaged'`, which should be cross-checked with valid status values in the application.

---

`109-111`: **Mobile Phone Number Update**  
The `mobilePhoneNumber` has been updated to use a consistent phone number format.

---

`113-115`: **Name Field Update**  
The `name` property is set to `'Rishav Jha'`, matching the intended test data. Consider introducing variability in test data if needed for robustness.

---

`117-119`: **Natal Sex Field Update**  
The `natalSex` field is now provided as `'male'`. Confirm that this sample is in line with related components’ expectations.

---

`121-123`: **Natural Language Code**  
The `naturalLanguageCode` is now assigned `'en'`. This aligns with common usage for English and should be validated in integration tests.

---

`125-127`: **Postal Code Field**  
The `postalCode` is updated to a string `'111111'`. Verify that this placeholder format is adequate for the intended locale or is replaced in production.

---

`129-131`: **User Role Field**  
The `role` property is now declared as `'regular'`. Ensure that this designation is consistent with the roles defined in the backend.

---

`133-135`: **State Field Update**  
The `state` field now holds `'State1'`. Confirm that this representative state name meets testing or illustrative purposes.

---

`137-139`: **UpdatedAt Timestamp Field**  
The `updatedAt` field has been provided with a current timestamp string. Verify that such timestamps are correctly processed by date handlers in the application.

---

`141-143`: **Work Phone Number Update**  
The `workPhoneNumber` field now uses a similar format to other phone numbers. Consistency checks against overall data formatting are recommended.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 19, 2025
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

@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: 4

🧹 Nitpick comments (2)
src/screens/OrgPost/OrgPost.tsx (1)

246-288: Improve error handling in handleAddMediaChange.

The error handling in the file upload function could be improved:

  1. Add file size validation
  2. Use more specific error messages
  3. Handle file type validation more robustly
 const handleAddMediaChange = async (
   e: React.ChangeEvent<HTMLInputElement>,
 ): Promise<void> => {
   const selectedFile = e.target.files?.[0];

   if (selectedFile) {
-    console.log('Selected file:', {
-      name: selectedFile.name,
-      type: selectedFile.type,
-      size: selectedFile.size,
-    });

+    // Validate file size (e.g., 5MB limit)
+    const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
+    if (selectedFile.size > MAX_FILE_SIZE) {
+      toast.error('File size exceeds 5MB limit');
+      return;
+    }

     // Validate file type
+    const ALLOWED_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'video/mp4', 'video/webm'];
     if (
-      !selectedFile.type.startsWith('image/') &&
-      !selectedFile.type.startsWith('video/')
+      !ALLOWED_TYPES.includes(selectedFile.type)
     ) {
-      toast.error('Please select an image or video file');
+      toast.error('Please select a valid image (JPEG, PNG, GIF) or video (MP4, WebM) file');
       return;
     }

     // Store the raw file
     setFile(selectedFile);

     // Create preview
     try {
       const base64 = await convertToBase64(selectedFile);
       setPostFormState((prev) => ({
         ...prev,
         addMedia: base64,
       }));
     } catch (error) {
-      console.error('Preview generation error:', error);
       toast.error('Could not generate preview');
     }
   } else {
     setFile(null);
     setPostFormState((prev) => ({
       ...prev,
       addMedia: '',
     }));
   }
 };
docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1)

34-34: Fix grammar in state description.

Change "create post modal" to "creation post modal" or "post creation modal" for better grammar.

-postmodalisOpen: boolean - Controls the visibility of the create post modal.
+postmodalisOpen: boolean - Controls the visibility of the post creation modal.
🧰 Tools
🪛 LanguageTool

[grammar] ~34-~34: The word ‘create’ is a verb. Did you mean the noun “creation”?
Context: ...oolean - Controls the visibility of the create post modal. - postformState: object - S...

(PREPOSITION_VERB)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 221ab61 and 99c155f.

📒 Files selected for processing (3)
  • docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/functions/default.md (1 hunks)
  • docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/functions/default.md
🧰 Additional context used
🪛 LanguageTool
docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md

[grammar] ~34-~34: The word ‘create’ is a verb. Did you mean the noun “creation”?
Context: ...oolean - Controls the visibility of the create post modal. - postformState: object - S...

(PREPOSITION_VERB)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (2)
src/screens/OrgPost/OrgPost.tsx (1)

80-116: LGTM! Comprehensive component documentation.

The TSDoc for the OrgPost component is well-structured and provides clear information about the component's features, dependencies, state management, and GraphQL operations.

docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1)

11-44: LGTM! Well-structured documentation.

The documentation is comprehensive and clearly describes the component's features, dependencies, state management, and GraphQL operations. The structure makes it easy for developers to understand the component's functionality.

🧰 Tools
🪛 LanguageTool

[grammar] ~34-~34: The word ‘create’ is a verb. Did you mean the noun “creation”?
Context: ...oolean - Controls the visibility of the create post modal. - postformState: object - S...

(PREPOSITION_VERB)

@NishantSinghhhhh
Copy link
Contributor Author

NishantSinghhhhh commented Feb 20, 2025

@palisadoes,

I wanted to inquire whether it is necessary to include the author's name in the posts. I noticed that the query for posts in the talwa-api does not contain a field for creatorId. Could you please provide guidance on this matter?

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 20, 2025
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
NishantSinghhhhh and others added 2 commits February 22, 2025 04:25
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
}}
className={`mb-3 ${styles.inputField}`}
accept="video/*"
onChange={handleVideoUpload}

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
<Modal.Header closeButton className={styles.modalHeader}>
<Modal.Title>{t('editPost')}</Modal.Title>
</Modal.Header>

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
@NishantSinghhhhh
Copy link
Contributor Author

@palisadoes , Will be writing tests for them now ,and will make sure to get this merged by today

NishantSinghhhhh and others added 2 commits February 22, 2025 23:51
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link

codecov bot commented Feb 22, 2025

Codecov Report

Attention: Patch coverage is 33.92857% with 148 lines in your changes missing coverage. Please review.

Project coverage is 84.70%. Comparing base (3facd9f) to head (e4626ae).

Files with missing lines Patch % Lines
src/screens/OrgPost/OrgPost.tsx 38.26% 61 Missing and 10 partials ⚠️
src/components/OrgPostCard/OrgPostCard.tsx 34.84% 40 Missing and 3 partials ⚠️
src/screens/OrgPost/Posts.tsx 15.62% 21 Missing and 6 partials ⚠️
src/subComponents/SearchingButton.tsx 0.00% 7 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           develop-postgres    #3707      +/-   ##
====================================================
- Coverage             86.05%   84.70%   -1.36%     
====================================================
  Files                   371      373       +2     
  Lines                  9139     9226      +87     
  Branches               1925     1944      +19     
====================================================
- Hits                   7865     7815      -50     
- Misses                  909     1038     +129     
- Partials                365      373       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@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: 7

🔭 Outside diff range comments (2)
src/GraphQl/Mutations/OrganizationMutations.ts (1)

213-231: 🛠️ Refactor suggestion

Update mutation name and documentation to match new functionality.

The mutation has been changed from a toggle operation to a general update operation, but the name and documentation don't reflect this change.

-/**
- * GraphQL mutation to toggle the pinned status of a post.
- *
- * @param id - The ID of the post to be toggled.
- * @returns The updated post object with the new pinned status.
- */
+/**
+ * GraphQL mutation to update a post.
+ *
+ * @param input - The input object containing post update data.
+ * @returns The updated post object with the new data.
+ */

-export const TOGGLE_PINNED_POST = gql`
+export const UPDATE_POST = gql`
src/GraphQl/Queries/OrganizationQueries.ts (1)

66-113: 🛠️ Refactor suggestion

Add documentation for the filtered posts query.

The new FILTERED_ORGANIZATION_POSTS query lacks documentation explaining its filtering capabilities and parameters.

Add JSDoc comment:

+/**
+ * GraphQL query to retrieve filtered posts for an organization.
+ *
+ * @param input - The input object containing organization query parameters.
+ * @param title_contains - Optional. Filter posts by title substring.
+ * @param text_contains - Optional. Filter posts by text content substring.
+ * @param after - Optional. Cursor for pagination after a specific post.
+ * @param before - Optional. Cursor for pagination before a specific post.
+ * @param first - Optional. Number of posts to retrieve after the cursor.
+ * @param last - Optional. Number of posts to retrieve before the cursor.
+ * @returns The filtered organization posts with pagination information.
+ */
 export const FILTERED_ORGANIZATION_POSTS = gql`
♻️ Duplicate comments (2)
src/screens/OrgPost/OrgPost.tsx (2)

189-191: 🛠️ Refactor suggestion

Remove console.log statement.

Remove the unused console.log statement for filtered posts.

-if (filteredPosts.length === 0) {
-  console.log('No filtered posts found');
-}

173-173: 🛠️ Refactor suggestion

Remove console.log statement.

Remove the unused console.log statement for setShowTitle.

-console.log(setShowTitle);
🧹 Nitpick comments (20)
src/components/OrgPostCard/OrgPostCard.tsx (9)

19-28: Use consistent naming conventions in attachment interfaces.
The InterfacePostAttachment structure is well-defined, but ensure its naming matches other attachment structures in your codebase (e.g., “InterfaceAttachment”). This helps maintain a consistent naming convention across all interfaces.


30-38: Ensure optional fields reflect actual usage.
The interface InterfacePost might require optional fields such as creatorId or others if they are conditionally used. Make sure you only mark fields optional if you truly handle missing values in the code. If all posts must have a creatorId, consider making the field mandatory for better type safety.


135-140: Add input validation or sanitization for caption changes.
While you do .trim() on submission, consider adding more robust validation or at least clarifying the expected input format (length limits, special character handling, etc.).

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 136-137: src/components/OrgPostCard/OrgPostCard.tsx#L136-L137
Added lines #L136 - L137 were not covered by tests


182-186: Prevent repeated attachments in clearImage.
When clearing an image by url, ensure no edge cases exist if multiple attachments share the same url. This might warrant a unique identifier or a robust approach for correlating an attachment to be removed.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 182-182: src/components/OrgPostCard/OrgPostCard.tsx#L182
Added line #L182 was not covered by tests


[warning] 184-184: src/components/OrgPostCard/OrgPostCard.tsx#L184
Added line #L184 was not covered by tests


189-193: Prevent repeated attachments in clearVideo.
Similar to clearImage, confirm that multiple items can’t inadvertently be removed if they share the same url.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 189-189: src/components/OrgPostCard/OrgPostCard.tsx#L189
Added line #L189 was not covered by tests


[warning] 191-191: src/components/OrgPostCard/OrgPostCard.tsx#L191
Added line #L191 was not covered by tests


203-209: Improve delete confirmation.
The user flow reloads the page within two seconds after success. Consider whether immediate redirect is needed or if the user should remain on the same page to confirm the post was removed.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 204-204: src/components/OrgPostCard/OrgPostCard.tsx#L204
Added line #L204 was not covered by tests


242-320: Optimize large media previews.
For potentially large videos or images, consider lazy-loading or setting a smaller preview to improve performance. This might be beneficial for many attachments.


423-466: Consolidate repeated preview logic.
There is similar code for image and video previews, including clearing attachments. Consider extracting these into a small helper component or function to reduce duplication and keep the file maintainable.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 423-423: src/components/OrgPostCard/OrgPostCard.tsx#L423
Added line #L423 was not covered by tests


[warning] 425-425: src/components/OrgPostCard/OrgPostCard.tsx#L425
Added line #L425 was not covered by tests


[warning] 430-430: src/components/OrgPostCard/OrgPostCard.tsx#L430
Added line #L430 was not covered by tests


[warning] 447-447: src/components/OrgPostCard/OrgPostCard.tsx#L447
Added line #L447 was not covered by tests


[warning] 449-449: src/components/OrgPostCard/OrgPostCard.tsx#L449
Added line #L449 was not covered by tests


[warning] 460-460: src/components/OrgPostCard/OrgPostCard.tsx#L460
Added line #L460 was not covered by tests


480-485: Validate DeletePostModal usage.
Double-check that the DeletePostModal properly manages open/close states and ensures no memory leak by reloading the page. Possibly unify the approach with the main modal logic for consistency.

src/subComponents/SearchingButton.tsx (2)

29-38: Future-proof for additional icon types.
You currently support either 'sort' or 'filter'. If further icons are expected (e.g., search, refresh), consider a more extensible approach, possibly mapping a type string to an icon registry.


54-60: Redundant PropTypes usage if you have TypeScript.
TypeScript is already ensuring strong typing. PropTypes can be beneficial for runtime checks, but consider if they’re strictly needed to avoid code duplication.

src/types/Post/interface.ts (1)

18-22: Confirm correct usage of creator fields.
InterfacePostCreator includes optional firstName and lastName. If the code expects a fallback to a single user name or handle, consider a single computed property or ensure you gracefully handle missing fields.

src/screens/OrgPost/Posts.tsx (3)

56-57: Enhance error handling with more details.

Consider providing more informative error messages and potentially using a dedicated error component. This would help users better understand what went wrong.

-  if (error) return <div>Error loading posts</div>;
+  if (error) return (
+    <div className="error-message">
+      <h3>Error loading posts</h3>
+      <p>{error.message}</p>
+    </div>
+  );

62-96: Consider dynamic mime type detection.

The function currently uses hardcoded mime types ('image/jpeg' and 'video/mp4'). This could be problematic if other file types are uploaded.

Consider using a mime type detection library or accepting mime types as parameters:

 const createAttachments = (
   post: InterfacePost,
   createdAt: Date,
+  imageMimeType = 'image/jpeg',
+  videoMimeType = 'video/mp4'
 ): {
   id: string;
   postId: string;
   name: string;
   mimeType: string;
   createdAt: Date;
 }[] => {
   return [
     ...(post.imageUrl
       ? [
           {
             id: `${post.id}-image`,
             postId: post.id,
             name: post.imageUrl,
-            mimeType: 'image/jpeg',
+            mimeType: imageMimeType,
             createdAt,
           },
         ]
       : []),
     ...(post.videoUrl
       ? [
           {
             id: `${post.id}-video`,
             postId: post.id,
             name: post.videoUrl,
-            mimeType: 'video/mp4',
+            mimeType: videoMimeType,
             createdAt,
           },
         ]
       : []),
   ];
 };

98-117: Use optional chaining for safer property access.

The code can be simplified using optional chaining for accessing the creator's ID.

-          creatorId: post.creator?.id || null,
+          creatorId: post.creator?.id ?? null,

Also consider adding a type guard to improve type safety:

if (!post?.id || typeof post.id !== 'string') return null;
src/screens/OrgPost/OrgPost.spec.tsx (1)

193-219: Enhance test coverage for file upload functionality.

While basic file upload testing is present, consider adding these test cases:

  1. Upload an invalid file type
  2. Handle file upload errors
  3. Test file size limits
  4. Verify file preview for different file types

Example test case for invalid file type:

it('should show error for invalid file type', async () => {
  const invalidFile = new File(['invalid'], 'test.txt', { type: 'text/plain' });
  const fileInput = screen.getByTestId('addMediaField');
  await userEvent.upload(fileInput, invalidFile);
  expect(await screen.findByText('Please select an image or video file')).toBeInTheDocument();
});
src/GraphQl/Queries/Queries.ts (1)

419-435: Add documentation for the new GraphQL query.

Add a descriptive comment explaining the purpose and usage of the GET_POSTS_BY_ORG query.

+/**
+ * Query to fetch posts for a specific organization.
+ * @param input GetPostsByOrgInput - Contains organizationId
+ * @returns List of posts with their details including attachments and creator info
+ */
export const GET_POSTS_BY_ORG = gql`
  query GetPostsByOrg($input: GetPostsByOrgInput!) {
    postsByOrganization(input: $input) {
docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1)

11-12: Enhance component documentation.

The current documentation is minimal. Consider adding:

  1. Description of props (if any)
  2. State management details
  3. Key features (sorting, filtering, pagination)
  4. Example usage
OrgPost Component
-This component is responsible for rendering and managing organization posts.
+This component is responsible for rendering and managing organization posts with the following features:
+- Create, view, and manage posts
+- Sort posts by creation date (latest/oldest)
+- Search posts by title
+- Pagination support
+- File attachment support (images/videos)
+
+@example
+```tsx
+<OrgPost />
+```
docs/docs/auto-docs/screens/OrgPost/Posts/functions/default.md (1)

21-25: Prefer Using Headings Rather Than Emphasis for Deprecated & See

Static analysis tools (MD036) flagged the use of double-asterisk emphasis in place of headings. Consider replacing the emphasized text lines with proper markdown headings. For example:

- **Deprecated**
+ ### Deprecated
- **See**
+ ### See

This change will improve semantic clarity and consistency in the documentation.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

21-21: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


23-23: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

docs/docs/auto-docs/subComponents/SearchingButton/functions/default.md (1)

25-27: Prefer Using Headings Instead of Emphasis for Deprecated & See

Similar to the OrgPost documentation file, static analysis tools have flagged the use of emphasis for the "Deprecated" and "See" labels. It is recommended to switch these to markdown headings (e.g., ### Deprecated and ### See) to adhere to best practices in markdown formatting:

- **Deprecated**
+ ### Deprecated
- **See**
+ ### See

This adjustment enhances readability and consistency within the documentation.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

25-25: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


27-27: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99c155f and c674a41.

📒 Files selected for processing (80)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/ADD_CUSTOM_FIELD.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/CANCEL_MEMBERSHIP_REQUEST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/JOIN_PUBLIC_ORGANIZATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/REMOVE_CUSTOM_FIELD.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/FILTERED_ORGANIZATION_POSTS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/GET_POSTS_BY_ORG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADMINS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADVERTISEMENT_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_FUNDS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_USER_TAGS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_CREATED_ORGANIZATIONS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_JOINED_ORGANIZATIONS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_ORGANIZATION_CONNECTION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/VENUE_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_DATA_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_MEMBERS_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_POSTS_BY_ORG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_USER_BY_ID.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md (1 hunks)
  • docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/functions/default.md (1 hunks)
  • docs/docs/auto-docs/screens/OrgPost/OrgPost/functions/default.md (1 hunks)
  • docs/docs/auto-docs/screens/OrgPost/Posts/functions/default.md (1 hunks)
  • docs/docs/auto-docs/subComponents/SearchingButton/functions/default.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceAttachment.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceCreator.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceMutationCreatePostInput.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceOrganization.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceOrganizationPostListData.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePageInfo.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePost.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostConnection.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostCreator.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostEdge.md (1 hunks)
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostNode.md (1 hunks)
  • src/GraphQl/Mutations/OrganizationMutations.ts (1 hunks)
  • src/GraphQl/Queries/OrganizationQueries.ts (1 hunks)
  • src/GraphQl/Queries/Queries.ts (1 hunks)
  • src/components/OrgPostCard/OrgPostCard.spec.tsx (1 hunks)
  • src/components/OrgPostCard/OrgPostCard.tsx (1 hunks)
  • src/screens/OrgPost/OrgPost.spec.tsx (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (8 hunks)
  • src/screens/OrgPost/Posts.tsx (1 hunks)
  • src/subComponents/SearchingButton.tsx (1 hunks)
  • src/types/Post/interface.ts (1 hunks)
✅ Files skipped from review due to trivial changes (34)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_USER_BY_ID.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostCreator.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_PG.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_DATA_PG.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/GET_POSTS_BY_ORG.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostNode.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceAttachment.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceOrganizationPostListData.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostEdge.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_POSTS_BY_ORG.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePostConnection.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceMutationCreatePostInput.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePageInfo.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceCreator.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfaceOrganization.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_MEMBERS_PG.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md
  • docs/docs/auto-docs/types/Post/interface/interfaces/InterfacePost.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS_PG.md
🚧 Files skipped from review as they are similar to previous changes (33)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADMINS_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/REMOVE_CUSTOM_FIELD.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_FUNDS.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/FILTERED_ORGANIZATION_POSTS.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_USER_TAGS_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_JOINED_ORGANIZATIONS.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/CANCEL_MEMBERSHIP_REQUEST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/ORGANIZATION_ADVERTISEMENT_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/VENUE_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_ORGANIZATION_CONNECTION.md
  • docs/docs/auto-docs/components/OrgPostCard/OrgPostCard/functions/default.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/ADD_CUSTOM_FIELD.md
  • docs/docs/auto-docs/GraphQl/Queries/OrganizationQueries/variables/USER_CREATED_ORGANIZATIONS.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/JOIN_PUBLIC_ORGANIZATION.md
🧰 Additional context used
🧠 Learnings (2)
src/GraphQl/Queries/Queries.ts (1)
Learnt from: hustlernik
PR: PalisadoesFoundation/talawa-admin#3534
File: src/GraphQl/Queries/Queries.ts:388-395
Timestamp: 2025-02-07T13:00:35.500Z
Learning: The `GET_ORGANIZATION_POSTS_PG` query is designed to fetch only a few recent posts using the `first` parameter, and pagination is intentionally omitted as it's not required for this use case.
src/GraphQl/Queries/OrganizationQueries.ts (1)
Learnt from: hustlernik
PR: PalisadoesFoundation/talawa-admin#3534
File: src/GraphQl/Queries/Queries.ts:388-395
Timestamp: 2025-02-07T13:00:35.500Z
Learning: The `GET_ORGANIZATION_POSTS_PG` query is designed to fetch only a few recent posts using the `first` parameter, and pagination is intentionally omitted as it's not required for this use case.
🪛 GitHub Check: codecov/patch
src/screens/OrgPost/OrgPost.tsx

[warning] 129-129: src/screens/OrgPost/OrgPost.tsx#L129
Added line #L129 was not covered by tests


[warning] 138-138: src/screens/OrgPost/OrgPost.tsx#L138
Added line #L138 was not covered by tests


[warning] 155-155: src/screens/OrgPost/OrgPost.tsx#L155
Added line #L155 was not covered by tests


[warning] 165-165: src/screens/OrgPost/OrgPost.tsx#L165
Added line #L165 was not covered by tests


[warning] 185-186: src/screens/OrgPost/OrgPost.tsx#L185-L186
Added lines #L185 - L186 were not covered by tests


[warning] 204-204: src/screens/OrgPost/OrgPost.tsx#L204
Added line #L204 was not covered by tests


[warning] 216-219: src/screens/OrgPost/OrgPost.tsx#L216-L219
Added lines #L216 - L219 were not covered by tests


[warning] 232-232: src/screens/OrgPost/OrgPost.tsx#L232
Added line #L232 was not covered by tests

src/components/OrgPostCard/OrgPostCard.tsx

[warning] 86-86: src/components/OrgPostCard/OrgPostCard.tsx#L86
Added line #L86 was not covered by tests


[warning] 103-103: src/components/OrgPostCard/OrgPostCard.tsx#L103
Added line #L103 was not covered by tests


[warning] 106-107: src/components/OrgPostCard/OrgPostCard.tsx#L106-L107
Added lines #L106 - L107 were not covered by tests


[warning] 136-137: src/components/OrgPostCard/OrgPostCard.tsx#L136-L137
Added lines #L136 - L137 were not covered by tests


[warning] 146-146: src/components/OrgPostCard/OrgPostCard.tsx#L146
Added line #L146 was not covered by tests


[warning] 148-149: src/components/OrgPostCard/OrgPostCard.tsx#L148-L149
Added lines #L148 - L149 were not covered by tests


[warning] 165-165: src/components/OrgPostCard/OrgPostCard.tsx#L165
Added line #L165 was not covered by tests


[warning] 167-168: src/components/OrgPostCard/OrgPostCard.tsx#L167-L168
Added lines #L167 - L168 were not covered by tests


[warning] 182-182: src/components/OrgPostCard/OrgPostCard.tsx#L182
Added line #L182 was not covered by tests


[warning] 184-184: src/components/OrgPostCard/OrgPostCard.tsx#L184
Added line #L184 was not covered by tests


[warning] 189-189: src/components/OrgPostCard/OrgPostCard.tsx#L189
Added line #L189 was not covered by tests


[warning] 191-191: src/components/OrgPostCard/OrgPostCard.tsx#L191
Added line #L191 was not covered by tests


[warning] 204-204: src/components/OrgPostCard/OrgPostCard.tsx#L204
Added line #L204 was not covered by tests


[warning] 229-230: src/components/OrgPostCard/OrgPostCard.tsx#L229-L230
Added lines #L229 - L230 were not covered by tests


[warning] 236-236: src/components/OrgPostCard/OrgPostCard.tsx#L236
Added line #L236 was not covered by tests


[warning] 381-381: src/components/OrgPostCard/OrgPostCard.tsx#L381
Added line #L381 was not covered by tests


[warning] 423-423: src/components/OrgPostCard/OrgPostCard.tsx#L423
Added line #L423 was not covered by tests


[warning] 425-425: src/components/OrgPostCard/OrgPostCard.tsx#L425
Added line #L425 was not covered by tests


[warning] 430-430: src/components/OrgPostCard/OrgPostCard.tsx#L430
Added line #L430 was not covered by tests


[warning] 447-447: src/components/OrgPostCard/OrgPostCard.tsx#L447
Added line #L447 was not covered by tests


[warning] 449-449: src/components/OrgPostCard/OrgPostCard.tsx#L449
Added line #L449 was not covered by tests


[warning] 460-460: src/components/OrgPostCard/OrgPostCard.tsx#L460
Added line #L460 was not covered by tests

🪛 GitHub Check: CodeQL
src/components/OrgPostCard/OrgPostCard.tsx

[warning] 377-377: DOM text reinterpreted as HTML
DOM text is reinterpreted as HTML without escaping meta-characters.


[warning] 403-403: DOM text reinterpreted as HTML
DOM text is reinterpreted as HTML without escaping meta-characters.

🪛 Biome (1.9.4)
src/screens/OrgPost/Posts.tsx

[error] 127-129: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🪛 markdownlint-cli2 (0.17.2)
docs/docs/auto-docs/screens/OrgPost/Posts/functions/default.md

21-21: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


23-23: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

docs/docs/auto-docs/subComponents/SearchingButton/functions/default.md

25-25: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


27-27: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (24)
src/components/OrgPostCard/OrgPostCard.tsx (7)

52-58: Validate postFormState initialization.
By default, post.caption is directly assigned to caption. If post.caption can be undefined or empty, ensure that remains valid for your form logic. You might also consider adding defensive checks if caption is required.


80-109: Improve test coverage for togglePostPin mutation flow.
Static analysis shows lines 86, 103, and 106–107 are uncovered by tests. Consider adding unit tests or integration tests that verify the pinned state toggles and toast messages.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 86-86: src/components/OrgPostCard/OrgPostCard.tsx#L86
Added line #L86 was not covered by tests


[warning] 103-103: src/components/OrgPostCard/OrgPostCard.tsx#L103
Added line #L103 was not covered by tests


[warning] 106-107: src/components/OrgPostCard/OrgPostCard.tsx#L106-L107
Added lines #L106 - L107 were not covered by tests


144-149: Add test coverage for image uploads.
Static analysis indicates line 146 and lines 148–149 are not covered by tests. Consider writing a test checking for correct state updates after an image file is selected.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 146-146: src/components/OrgPostCard/OrgPostCard.tsx#L146
Added line #L146 was not covered by tests


[warning] 148-149: src/components/OrgPostCard/OrgPostCard.tsx#L148-L149
Added lines #L148 - L149 were not covered by tests


162-168: Add test coverage for video uploads.
Like image uploads, lines 165 and 167–168 are not tested. Ensure you add tests confirming that the state is updated with the correct base64 data for video attachments.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 165-165: src/components/OrgPostCard/OrgPostCard.tsx#L165
Added line #L165 was not covered by tests


[warning] 167-168: src/components/OrgPostCard/OrgPostCard.tsx#L167-L168
Added lines #L167 - L168 were not covered by tests


214-237: Add test coverage for updatePost.
Lines 229–230 and 236 have no coverage. Add tests confirming updates to the caption and attachments, as well as correct toast feedback on success/failure.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 229-230: src/components/OrgPostCard/OrgPostCard.tsx#L229-L230
Added lines #L229 - L230 were not covered by tests


[warning] 236-236: src/components/OrgPostCard/OrgPostCard.tsx#L236
Added line #L236 was not covered by tests


377-377: Check for HTML reinterpretation in dynamic text.
Static analysis flags potential issues with text being interpreted as HTML. Although it’s likely a false positive for a simple <li> usage, confirm that user-supplied text is properly escaped if displayed here.

🧰 Tools
🪛 GitHub Check: CodeQL

[warning] 377-377: DOM text reinterpreted as HTML
DOM text is reinterpreted as HTML without escaping meta-characters.


403-403: HTML label usage may trigger code scanning alert.
CodeQL flags certain label usage patterns. Although typically safe, watch for dynamic user input that could be interpreted as HTML. Ensure safe rendering if content is dynamic.

🧰 Tools
🪛 GitHub Check: CodeQL

[warning] 403-403: DOM text reinterpreted as HTML
DOM text is reinterpreted as HTML without escaping meta-characters.

src/subComponents/SearchingButton.tsx (1)

8-21: Clarify required vs. optional props.
title, text, dropdownTestId, and className are optional. Confirm that your usage across the codebase accounts for those possibly being undefined (e.g., passing no title but referencing it in the component).

src/types/Post/interface.ts (5)

24-33: Ensure pinnedAt and pinned usage sync with code.
In InterfacePostNode, you have pinned?: boolean and createdAt. Confirm that all pinned logic is consistent and that createdAt is a required string type in your actual GraphQL schema.


35-38: Align InterfacePostEdge node type.
You replaced InterfacePostNode with InterfacePost. Confirm that external code using InterfacePostEdge is updated to reflect the new shape.


46-49: Add coverage for pageInfo.
InterfacePostConnection includes a pageInfo object. Make sure your tests cover scenarios for hasNextPage and hasPreviousPage logic, as they’re vital for pagination correctness.


60-62: Check for potential null “organization” in GET queries.
InterfaceOrganizationPostListData has a non-null organization. If the query or server can return null for an organization, handle that gracefully.


64-70: Validate file attachments usage.
InterfaceMutationCreatePostInput allows an optional attachments?: File[]. Confirm that the UI and backend handle file uploads consistently for pinned or unpinned posts.

src/screens/OrgPost/Posts.tsx (3)

27-45: LGTM! Well-structured interfaces with proper TypeScript types.

The interfaces are well-defined with clear purpose and proper typing. The JSDoc comments provide good documentation of the component's props and their usage.


147-153: LGTM! Clear and concise sorting implementation.

The sorting logic is well-implemented with proper checks for the sorting option and posts length.


155-165: LGTM! Robust final rendering implementation.

The code effectively handles edge cases and uses filter(Boolean) to safely remove null values from the rendered output.

src/components/OrgPostCard/OrgPostCard.spec.tsx (2)

36-128: LGTM! Well-structured mock data and GraphQL mocks.

The mock data and GraphQL operation mocks are comprehensive and properly typed, covering all necessary test scenarios.


130-150: LGTM! Clean test setup with proper mock handling.

The test setup follows best practices with proper mock initialization and cleanup.

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

6-47: Update query documentation to match new functionality.

The JSDoc comment still refers to retrieving a list of organizations, but the query now focuses on retrieving posts for a specific organization.

Update the documentation to reflect the current functionality:

 /**
- * GraphQL query to retrieve the list of organizations.
+ * GraphQL query to retrieve posts for a specific organization.
  *
- * @param first - Optional. Number of organizations to retrieve in the first batch.
- * @param skip - Optional. Number of organizations to skip before starting to collect the result set.
- * @param filter - Optional. Filter organizations by a specified string.
- * @param id - Optional. The ID of a specific organization to retrieve.
+ * @param input - The input object containing organization query parameters.
+ * @param after - Optional. Cursor for pagination after a specific post.
+ * @param before - Optional. Cursor for pagination before a specific post.
+ * @param first - Optional. Number of posts to retrieve after the cursor.
+ * @param last - Optional. Number of posts to retrieve before the cursor.
- * @returns The list of organizations based on the applied filters.
+ * @returns The organization's posts with pagination information.
  */
src/screens/OrgPost/OrgPost.tsx (3)

129-165: Add test coverage for file upload functionality.

The file upload functionality lacks test coverage. Add tests to cover:

  • Creating a post with file attachments
  • Error handling for invalid file types
  • Successful file upload scenarios

Based on the static analysis hints, the following lines need test coverage:

  • Line 129: Input object creation
  • Line 138: File upload handling
  • Line 155: Post creation success
  • Line 165: File state reset
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 129-129: src/screens/OrgPost/OrgPost.tsx#L129
Added line #L129 was not covered by tests


[warning] 138-138: src/screens/OrgPost/OrgPost.tsx#L138
Added line #L138 was not covered by tests


[warning] 155-155: src/screens/OrgPost/OrgPost.tsx#L155
Added line #L155 was not covered by tests


[warning] 165-165: src/screens/OrgPost/OrgPost.tsx#L165
Added line #L165 was not covered by tests


216-219: Add test coverage for pagination logic.

The pagination logic in the useEffect hook lacks test coverage. Add tests to verify:

  • Correct page calculation
  • Proper slicing of posts
  • Display updates on page changes

Based on the static analysis hints, lines 216-219 need test coverage for the pagination logic.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 216-219: src/screens/OrgPost/OrgPost.tsx#L216-L219
Added lines #L216 - L219 were not covered by tests


232-232: Add test coverage for post sorting.

The post sorting functionality lacks test coverage. Add tests to verify:

  • Correct sorting of posts array
  • State updates after sorting

Based on the static analysis hints, line 232 needs test coverage for the post sorting functionality.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 232-232: src/screens/OrgPost/OrgPost.tsx#L232
Added line #L232 was not covered by tests

docs/docs/auto-docs/screens/OrgPost/Posts/functions/default.md (1)

1-30: Overall Documentation Clarity

The documentation is well-structured and clearly communicates the function's signature, parameters, and return type. The inclusion of a direct link to the source definition and references to related React documentation is very helpful.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

21-21: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


23-23: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

docs/docs/auto-docs/subComponents/SearchingButton/functions/default.md (1)

1-36: Overall Documentation Quality

The documentation clearly describes the default function for the SearchingButton component, detailing its parameters and return type. It provides a concise description of the component’s behavior along with a reference to the appropriate source file and legacy context guidance.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

25-25: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


27-27: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 22, 2025
NishantSinghhhhh and others added 3 commits February 23, 2025 13:48
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

@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: 3

🔭 Outside diff range comments (2)
src/screens/OrgPost/OrgPost.tsx (2)

116-171: 🛠️ Refactor suggestion

Enhance validation and error handling in createPost.

Add validation for postinfo field and improve error handling.

 const createPost = async (e: ChangeEvent<HTMLFormElement>): Promise<void> => {
   e.preventDefault();

   try {
     if (!postformState.posttitle.trim()) {
       throw new Error('Title field cannot be empty');
     }

+    if (!postformState.postinfo.trim()) {
+      throw new Error('Information field cannot be empty');
+    }

     if (!currentUrl) {
       throw new Error('Organization ID is required');
     }

     // Create the typed input object
     const input: InterfaceMutationCreatePostInput = {
       caption: postformState.posttitle.trim(),
+      text: postformState.postinfo.trim(),
       organizationId: currentUrl,
       isPinned: postformState.pinPost,
     };

     // Handle file upload
     if (file instanceof File) {
+      // Validate file size
+      const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
+      if (file.size > MAX_FILE_SIZE) {
+        throw new Error('File size exceeds 5MB limit');
+      }
       input.attachments = [file];
     }

     const { data } = await create({
       variables: {
         input,
       },
       context: {
         headers: {
           'Apollo-Require-Preflight': 'true',
         },
       },
     });

     if (data?.createPost) {
       toast.success(t('postCreatedSuccess') as string);
       await refetch();

       setPostFormState({
         posttitle: '',
         postinfo: '',
         postImage: '',
         postVideo: '',
         addMedia: '',
         pinPost: false,
       });
       setFile(null);
       setPostModalIsOpen(false);
     }
   } catch (error: unknown) {
-    errorHandler(t, error);
+    if (error instanceof Error) {
+      toast.error(error.message);
+    } else {
+      errorHandler(t, error);
+    }
   }
 };

43-67: 🛠️ Refactor suggestion

Consolidate state management.

Consider using a reducer to manage related state and improve state updates.

+interface PostState {
+  posts: InterfacePost[];
+  filteredPosts: InterfacePostEdge[];
+  sortedPosts: InterfacePost[];
+  displayPosts: InterfacePost[];
+  currentPage: number;
+  sortingOption: string;
+  searchTerm: string;
+  isFiltering: boolean;
+  isLoading: boolean;
+}
+
+type PostAction =
+  | { type: 'SET_POSTS'; payload: InterfacePost[] }
+  | { type: 'SET_FILTERED_POSTS'; payload: InterfacePostEdge[] }
+  | { type: 'SET_SORTING_OPTION'; payload: string }
+  | { type: 'SET_CURRENT_PAGE'; payload: number }
+  | { type: 'SET_SEARCH_TERM'; payload: string }
+  | { type: 'SET_IS_FILTERING'; payload: boolean }
+  | { type: 'SET_IS_LOADING'; payload: boolean };
+
+const postReducer = (state: PostState, action: PostAction): PostState => {
+  switch (action.type) {
+    case 'SET_POSTS':
+      return { ...state, posts: action.payload };
+    case 'SET_FILTERED_POSTS':
+      return { ...state, filteredPosts: action.payload };
+    case 'SET_SORTING_OPTION':
+      return { ...state, sortingOption: action.payload };
+    case 'SET_CURRENT_PAGE':
+      return { ...state, currentPage: action.payload };
+    case 'SET_SEARCH_TERM':
+      return { ...state, searchTerm: action.payload };
+    case 'SET_IS_FILTERING':
+      return { ...state, isFiltering: action.payload };
+    case 'SET_IS_LOADING':
+      return { ...state, isLoading: action.payload };
+    default:
+      return state;
+  }
+};
+
-const [sortingOption, setSortingOption] = useState('None');
-const [currentPage, setCurrentPage] = useState(1);
-const [displayPosts, setDisplayPosts] = useState<InterfacePost[]>([]);
-const [sortedPosts, setSortedPosts] = useState<InterfacePost[]>([]);
-const [filteredPosts, setFilteredPosts] = useState<InterfacePostEdge[]>([]);
-const [searchTerm, setSearchTerm] = useState('');
-const [isFiltering, setIsFiltering] = useState(false);
+const [state, dispatch] = useReducer(postReducer, {
+  posts: [],
+  filteredPosts: [],
+  sortedPosts: [],
+  displayPosts: [],
+  currentPage: 1,
+  sortingOption: 'None',
+  searchTerm: '',
+  isFiltering: false,
+  isLoading: false,
+});
♻️ Duplicate comments (1)
src/screens/OrgPost/OrgPost.tsx (1)

173-173: 🛠️ Refactor suggestion

Remove console statements and improve error handling.

Replace console statements with proper error handling and logging.

-console.log(setShowTitle);

-console.error('Organization post list error:', orgPostListError);
-// Add proper error handling here
+toast.error('Failed to fetch organization posts');

-console.error('Search error:', error);
-toast.error('Error searching posts');
+toast.error(`Error searching posts: ${error instanceof Error ? error.message : 'Unknown error'}`);

Also applies to: 225-226, 287-288

🧹 Nitpick comments (5)
src/screens/OrgPost/OrgPost.spec.tsx (2)

146-178: Improve test robustness and performance.

Consider these enhancements:

  1. Add initial state verification to ensure modal is closed at start.
  2. Reduce timeout from 5000ms to a more reasonable value (e.g., 1000ms) for UI interactions.
 it('opens and closes the create post modal', async () => {
   renderComponent();
   await act(() => new Promise((resolve) => setTimeout(resolve, 0)));
+
+  // Verify initial state
+  expect(screen.queryByTestId('modalOrganizationHeader')).toBeNull();

   const openModalBtn = await screen.findByTestId(
     'createPostModalBtn',
     {},
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
   fireEvent.click(openModalBtn);

   // Wait for modal header to appear
   await waitFor(
     () => {
       expect(
         screen.getByTestId('modalOrganizationHeader'),
       ).toBeInTheDocument();
     },
-    { timeout: 5000 },
+    { timeout: 1000 },
   );

   // Close modal by clicking close button
   const closeModalBtn = screen.getByTestId('closeOrganizationModal');
   fireEvent.click(closeModalBtn);

   // Wait for modal to close
   await waitFor(
     () => {
       expect(screen.queryByTestId('modalOrganizationHeader')).toBeNull();
     },
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
 });

250-280: Enhance pin post toggle test coverage.

The test should verify:

  1. Form state update when toggle is clicked
  2. Mutation call with correct isPinned value
 it('handles pin post toggle', async () => {
   renderComponent();
   await act(() => new Promise((resolve) => setTimeout(resolve, 0)));

   // Wait for the create post button to appear and click it
   const openModalBtn = await screen.findByTestId(
     'createPostModalBtn',
     {},
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
   fireEvent.click(openModalBtn);

   // Now wait for the pin post switch to be rendered in the modal
   const pinSwitch = await screen.findByTestId(
     'pinPost',
     {},
-    { timeout: 5000 },
+    { timeout: 1000 },
   );

   // Simulate a click to toggle the pin switch
   fireEvent.click(pinSwitch);

   // Wait for the switch to be toggled (checking the checked property)
   await waitFor(
     () => {
       expect(pinSwitch).toBeChecked();
+      // Verify form state update
+      expect(postformState.pinPost).toBe(true);
     },
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
+
+  // Submit form and verify mutation call
+  const submitBtn = screen.getByTestId('createPostBtn');
+  fireEvent.click(submitBtn);
+
+  await waitFor(() => {
+    expect(create).toHaveBeenCalledWith({
+      variables: {
+        input: expect.objectContaining({
+          isPinned: true,
+        }),
+      },
+      context: expect.any(Object),
+    });
+  });
 });
src/screens/OrgPost/OrgPost.tsx (3)

261-290: Enhance search functionality.

Add text search, debounce, and loading state to improve search experience.

+import { useDebounce } from 'use-debounce';
+
 const handleSearch = async (term: string): Promise<void> => {
+  const [debouncedTerm] = useDebounce(term, 300);
   setSearchTerm(term);
+  setIsLoading(true);

   try {
     const { data: searchData } = await refetchPosts({
       input: { organizationId: currentUrl },
     });

     if (!term.trim()) {
       setIsFiltering(false);
       setFilteredPosts([]);
+      setIsLoading(false);
       return;
     }

     if (searchData?.postsByOrganization) {
       setIsFiltering(true);

       const filtered = searchData.postsByOrganization.filter(
         (post: InterfacePost) =>
-          post.caption.toLowerCase().includes(term.toLowerCase()),
+          post.caption.toLowerCase().includes(term.toLowerCase()) ||
+          post.text?.toLowerCase().includes(term.toLowerCase()),
       );
       setFilteredPosts(filtered);
     }
   } catch (error) {
     if (error instanceof Error) {
       toast.error(`Error searching posts: ${error.message}`);
     } else {
       toast.error('Error searching posts');
     }
   } finally {
+    setIsLoading(false);
   }
 };

292-325: Optimize sorting functionality.

Add memoization, loading state, and error handling to improve sorting performance.

+import { useMemo } from 'react';
+
 const handleSorting = (option: string): void => {
   setCurrentPage(1);
   setSortingOption(option);
+  setIsLoading(true);

   if (option === 'None') {
     setDisplayPosts([]);

-    refetchPosts({
-      input: {
-        organizationId: currentUrl,
-      },
-    });
+    try {
+      await refetchPosts({
+        input: {
+          organizationId: currentUrl,
+        },
+      });
+    } catch (error) {
+      if (error instanceof Error) {
+        toast.error(`Error refreshing posts: ${error.message}`);
+      } else {
+        toast.error('Error refreshing posts');
+      }
+    }
+    setIsLoading(false);
     return;
   }

   if (!['latest', 'oldest'].includes(option)) {
     return;
   }

   if (loading || error || !data?.postsByOrganization) {
     return;
   }

-  const posts = [...data.postsByOrganization];
-  const sorted = posts.sort((a, b) => {
-    const dateA = new Date(a.createdAt).getTime();
-    const dateB = new Date(b.createdAt).getTime();
-    return option === 'oldest' ? dateA - dateB : dateB - dateA;
-  });
+  const sorted = useMemo(() => {
+    const posts = [...data.postsByOrganization];
+    return posts.sort((a, b) => {
+      const dateA = new Date(a.createdAt).getTime();
+      const dateB = new Date(b.createdAt).getTime();
+      return option === 'oldest' ? dateA - dateB : dateB - dateA;
+    });
+  }, [data, option]);

   setSortedPosts(sorted);
   const initialPosts = sorted.slice(0, postsPerPage);
   setDisplayPosts(initialPosts);
+  setIsLoading(false);
 };

348-383: Enhance pagination functionality.

Add loading state, error handling, and scroll to top behavior.

 const handleNextPage = (): void => {
+  setIsLoading(true);
   if (sortingOption === 'None') {
     const endCursor =
       orgPostListData?.organization?.posts?.pageInfo?.endCursor;
     if (endCursor) {
       setAfter(endCursor);
       setBefore(null);
       setFirst(postsPerPage);
       setLast(null);
       setCurrentPage((prev) => prev + 1);
+      window.scrollTo({ top: 0, behavior: 'smooth' });
     }
   } else {
     const maxPage = Math.ceil(sortedPosts.length / postsPerPage);
     if (currentPage < maxPage) {
       setCurrentPage((prev) => prev + 1);
+      window.scrollTo({ top: 0, behavior: 'smooth' });
     }
   }
+  setIsLoading(false);
 };

 const handlePreviousPage = (): void => {
+  setIsLoading(true);
   if (sortingOption === 'None') {
     const startCursor =
       orgPostListData?.organization?.posts?.pageInfo?.startCursor;
     if (startCursor) {
       setBefore(startCursor);
       setAfter(null);
       setFirst(null);
       setLast(postsPerPage);
       setCurrentPage((prev) => prev - 1);
+      window.scrollTo({ top: 0, behavior: 'smooth' });
     }
   } else {
     if (currentPage > 1) {
       setCurrentPage((prev) => prev - 1);
+      window.scrollTo({ top: 0, behavior: 'smooth' });
     }
   }
+  setIsLoading(false);
 };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c674a41 and 6ac6b26.

📒 Files selected for processing (2)
  • src/screens/OrgPost/OrgPost.spec.tsx (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test Application
  • GitHub Check: Analyse Code With CodeQL (javascript)

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 23, 2025
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

@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: 0

♻️ Duplicate comments (3)
src/screens/OrgPost/OrgPost.tsx (3)

225-226: ⚠️ Potential issue

Replace console.error with proper error handling.

Error logging should use proper error handling mechanisms.

-console.error('Organization post list error:', orgPostListError);
-// Add proper error handling here
+toast.error('Failed to fetch organization posts');
+errorHandler(t, orgPostListError);

285-286: ⚠️ Potential issue

Improve search error handling.

The search error handling can be more informative.

-console.error('Search error:', error);
-toast.error('Error searching posts');
+errorHandler(t, error);
+toast.error(`Failed to search posts: ${error instanceof Error ? error.message : 'Unknown error'}`);

173-213: ⚠️ Potential issue

Remove console.log and enhance file validation.

The file handling logic needs improvement and contains debug statements.

  1. Remove the console.log statement
  2. Add comprehensive file validation:
-console.log(setShowTitle);
 const handleAddMediaChange = async (
   e: React.ChangeEvent<HTMLInputElement>,
 ): Promise<void> => {
   const selectedFile = e.target.files?.[0];

   if (selectedFile) {
+    // Validate file size (5MB limit)
+    const MAX_FILE_SIZE = 5 * 1024 * 1024;
+    if (selectedFile.size > MAX_FILE_SIZE) {
+      toast.error('File size exceeds 5MB limit');
+      return;
+    }

+    // Validate file type
+    const allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'video/mp4'];
+    if (!allowedTypes.includes(selectedFile.type)) {
+      toast.error('Unsupported file type. Please use JPG, PNG, GIF, or MP4');
+      return;
+    }

-    if (filteredPosts.length === 0) {
-      console.log('No filtered posts found');
-    }
🧹 Nitpick comments (5)
src/screens/OrgPost/OrgPost.spec.tsx (1)

190-190: Standardize timeout values across test cases.

The test cases use an inconsistent timeout value of 5000ms. Consider standardizing to a lower value (e.g., 1000ms) for faster test execution.

-      { timeout: 5000 },
+      { timeout: 1000 },

Also applies to: 200-200, 209-209, 217-217, 227-227, 240-240, 250-250, 260-260, 268-268, 278-278, 284-284, 291-291

src/screens/OrgPost/OrgPost.tsx (4)

1-27: Consolidate imports and improve type imports.

The imports section can be improved:

  1. GraphQL imports use inconsistent path styles (relative vs absolute)
  2. Type imports are mixed with value imports
-import { CREATE_POST_MUTATION } from 'GraphQl/Mutations/mutations';
-import { ORGANIZATION_POST_LIST } from 'GraphQl/Queries/Queries';
-import { GET_POSTS_BY_ORG } from '../../GraphQl/Queries/Queries';
+import { CREATE_POST_MUTATION } from '../../GraphQl/Mutations/mutations';
+import { GET_POSTS_BY_ORG, ORGANIZATION_POST_LIST } from '../../GraphQl/Queries/Queries';

-import type {
-  InterfacePostEdge,
-  InterfaceOrganizationPostListData,
-  InterfaceMutationCreatePostInput,
-  InterfacePost,
-} from '../../types/Post/interface';
+import type * as PostTypes from '../../types/Post/interface';

52-67: Consider using a reducer for complex state management.

The component manages multiple related states for posts, pagination, sorting, and filtering. This could be simplified using useReducer.

Consider consolidating these states into a reducer:

type PostsState = {
  sortingOption: string;
  currentPage: number;
  displayPosts: PostTypes.InterfacePost[];
  sortedPosts: PostTypes.InterfacePost[];
  filteredPosts: PostTypes.InterfacePostEdge[];
  searchTerm: string;
  isFiltering: boolean;
};

type PostsAction =
  | { type: 'SET_SORTING'; payload: string }
  | { type: 'SET_PAGE'; payload: number }
  | { type: 'SET_POSTS'; payload: PostTypes.InterfacePost[] }
  | { type: 'SET_SEARCH'; payload: string };

119-139: Improve error handling in createPost function.

The error handling has been improved with specific checks, but could be enhanced further.

 try {
   if (!postformState.posttitle.trim()) {
     throw new Error('Title field cannot be empty');
   }

   if (!currentUrl) {
     throw new Error('Organization ID is required');
   }

+  // Validate file size if present
+  if (file && file.size > 5 * 1024 * 1024) {
+    throw new Error('File size exceeds 5MB limit');
+  }

   const input: InterfaceMutationCreatePostInput = {
     caption: postformState.posttitle.trim(),
     organizationId: currentUrl,
     isPinned: postformState.pinPost,
   };

395-400: Remove commented-out code.

Commented-out code should be removed if it's no longer needed.

-                {/* <SearchingButton
-                  text="Search" 
-                  dataTestIdPrefix="sort-button"
-                  type="sort" 
-                  className={`${styles.dropdown} `}
-                /> */}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac6b26 and c2b43c5.

📒 Files selected for processing (2)
  • src/screens/OrgPost/OrgPost.spec.tsx (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test Application
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (7)
src/screens/OrgPost/OrgPost.spec.tsx (5)

221-242: Enhance form submission test coverage.

The test case should verify:

  1. The mutation call with correct variables
  2. Form state reset after submission
  3. Refetch call to update the posts list

418-492: Expand media handling test coverage.

The test cases for media handling are good but could be enhanced with additional edge cases.


515-660: Well-structured and comprehensive search functionality tests!

The test suite for search functionality:

  • Handles empty search terms
  • Implements case-insensitive search
  • Covers error scenarios
  • Tests partial matches
  • Includes proper cleanup

662-810: Excellent test coverage for sorting functionality!

The test suite:

  • Handles all sorting options
  • Preserves original data
  • Manages state correctly
  • Includes proper pagination integration
  • Tests edge cases

812-982: Comprehensive pagination test coverage!

The test suite:

  • Handles both cursor-based and offset-based pagination
  • Tests navigation in both directions
  • Covers edge cases
  • Integrates well with sorting options
src/screens/OrgPost/OrgPost.tsx (2)

325-341: LGTM: Pagination logic is well-implemented.

The pagination logic correctly handles both sorted and unsorted cases, with proper boundary checks.


463-584: LGTM: Form implementation is comprehensive.

The form implementation includes:

  • Proper validation
  • File upload handling
  • Preview functionality
  • Pin post option

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 23, 2025
@palisadoes
Copy link
Contributor

  1. Please make coderabbit.ai approves your work.
  2. Make sure all tests pass and are valid.
  3. Ensure the test code coverage for your patch reaches as close to 100% as possible.

Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
Copy link
Contributor

@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: 0

♻️ Duplicate comments (3)
src/screens/OrgPost/OrgPost.spec.tsx (1)

260-281: 🛠️ Refactor suggestion

Enhance test coverage for form submission.

The test case should verify the mutation call with correct variables and form state reset after submission.

 it('submits the create post form successfully', async () => {
   renderComponent();
   await act(() => new Promise((resolve) => setTimeout(resolve, 0)));
   
   const openModalBtn = await screen.findByTestId(
     'createPostModalBtn',
     {},
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
   fireEvent.click(openModalBtn);
   
   const titleInput = screen.getByTestId('modalTitle');
   const infoInput = screen.getByTestId('modalinfo');
   
   fireEvent.change(titleInput, { target: { value: 'Test Post Title' } });
   fireEvent.change(infoInput, { target: { value: 'Test Post Information' } });
   
   const submitBtn = screen.getByTestId('createPostBtn');
   fireEvent.click(submitBtn);
   
   await waitFor(
     () => {
       expect(toast.success).toHaveBeenCalled();
+      // Verify mutation was called with correct variables
+      expect(create).toHaveBeenCalledWith({
+        variables: {
+          input: {
+            caption: 'Test Post Title',
+            organizationId: '123',
+            isPinned: false,
+          },
+        },
+        context: {
+          headers: {
+            'Apollo-Require-Preflight': 'true',
+          },
+        },
+      });
+      // Verify form state was reset
+      expect(titleInput).toHaveValue('');
+      expect(infoInput).toHaveValue('');
     },
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
 });
src/screens/OrgPost/OrgPost.tsx (2)

204-243: 🛠️ Refactor suggestion

Enhance file validation and remove console.log.

The file validation could be more comprehensive, and debug statements should be removed.

 const handleAddMediaChange = async (
   e: React.ChangeEvent<HTMLInputElement>,
 ): Promise<void> => {
   const selectedFile = e.target.files?.[0];

   if (selectedFile) {
+    // Validate file size (e.g., 5MB limit)
+    const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
+    if (selectedFile.size > MAX_FILE_SIZE) {
+      toast.error('File size exceeds 5MB limit');
+      return;
+    }

     // Validate file type
     if (
       !selectedFile.type.startsWith('image/') &&
       !selectedFile.type.startsWith('video/')
     ) {
       toast.error('Please select an image or video file');
       return;
     }

-    if (filteredPosts.length === 0) {
-      console.log('No filtered posts found');
-    }

     // Store the raw file
     setFile(selectedFile);

253-258: 🛠️ Refactor suggestion

Improve error handling in useEffect.

Replace console.error with proper error handling using toast notifications.

 useEffect(() => {
   if (orgPostListError) {
-    console.error('Organization post list error:', orgPostListError);
-    // Add proper error handling here
+    toast.error('Failed to fetch organization posts');
   }
 }, [orgPostListError]);
🧹 Nitpick comments (6)
src/screens/OrgPost/OrgPost.spec.tsx (3)

24-66: Improve mock organization by extracting translation strings.

Consider extracting the translation strings into a separate constant for better maintainability and reusability.

+const MOCK_TRANSLATIONS = {
+  searchTitle: 'Search by title',
+  searchText: 'Search by text',
+  title: 'Organization Posts',
+  postDetails: 'Post Details',
+  postTitle: 'Post Title',
+  postTitle1: 'Enter post title',
+  information: 'Information',
+  information1: 'Enter information',
+  addMedia: 'Add Media',
+  pinPost: 'Pin Post',
+  addPost: 'Add Post',
+  createPost: 'Create Post',
+};

 vi.mock('react-i18next', () => ({
   initReactI18next: {
     type: '3rdParty',
     init: () => {},
   },
   useTranslation: () => ({
     t: (key: string) => {
-      const translations: { [key: string]: string } = {
-        searchTitle: 'Search by title',
-        searchText: 'Search by text',
-        title: 'Organization Posts',
-        postDetails: 'Post Details',
-        postTitle: 'Post Title',
-        postTitle1: 'Enter post title',
-        information: 'Information',
-        information1: 'Enter information',
-        addMedia: 'Add Media',
-        pinPost: 'Pin Post',
-        addPost: 'Add Post',
-        createPost: 'Create Post',
-      };
-      return translations[key] || key;
+      return MOCK_TRANSLATIONS[key] || key;
     },
     i18n: {
       changeLanguage: () => new Promise(() => {}),
       language: 'en',
     },
   }),
   Trans: ({ children }: { children: React.ReactNode }) => children,
   I18nextProvider: ({ children }: { children: React.ReactNode }) => children,
 }));

73-183: Add type assertions to mock data for better type safety.

The mock data structures could benefit from explicit type assertions to ensure type safety and catch potential issues during development.

-const mockPosts = {
+const mockPosts: { postsByOrganization: InterfacePost[] } = {
   postsByOrganization: [
     {
       _id: '1',
       caption: 'Test Post 1',
       createdAt: '2024-02-23T10:00:00Z',
       creatorid: '123',
       imageUrl: null,
       videoUrl: null,
       isPinned: false,
     },
     // ...
   ],
 };

-const createPostWithFileMock = {
+const createPostWithFileMock: { request: any; result: any } = {
   // ...
};

-const mockOrgPostList = {
+const mockOrgPostList: InterfaceOrganizationPostListData = {
   // ...
};

218-231: Reduce timeout duration and add error case testing.

The timeout duration is unnecessarily long, and the test could benefit from additional error case coverage.

 it('renders without crashing and displays search bar', async () => {
   renderComponent();
   // Wait for any async GraphQL queries to flush
   await act(() => new Promise((resolve) => setTimeout(resolve, 0)));
   
   await waitFor(
     () => {
       const searchBar = screen.getByTestId('searchByName');
       expect(searchBar).toBeInTheDocument();
+      // Add error case testing
+      expect(screen.queryByText('Error')).not.toBeInTheDocument();
     },
-    { timeout: 5000 },
+    { timeout: 1000 },
   );
 });
src/screens/OrgPost/OrgPost.tsx (3)

30-34: Enhance component documentation with props and examples.

The component documentation should include more details about its functionality, props, and usage examples.

 /**
  * OrgPost Component
  * This component is responsible for rendering and managing organization posts.
+ *
+ * @component
+ * @example
+ * ```tsx
+ * <OrgPost />
+ * ```
+ *
+ * Features:
+ * - Displays organization posts with pagination
+ * - Supports post creation with media upload
+ * - Implements sorting and filtering
+ * - Handles pinned posts
  */

43-68: Consider using a reducer for complex state management.

The component uses multiple related state variables that could be managed more effectively using a reducer.

+interface PostState {
+  modal: {
+    isOpen: boolean;
+    form: {
+      title: string;
+      info: string;
+      image: string;
+      video: string;
+      media: string;
+      isPinned: boolean;
+    };
+  };
+  posts: {
+    sorting: string;
+    currentPage: number;
+    display: InterfacePost[];
+    filtered: InterfacePostEdge[];
+    searchTerm: string;
+    isFiltering: boolean;
+  };
+}

+type PostAction =
+  | { type: 'OPEN_MODAL' }
+  | { type: 'CLOSE_MODAL' }
+  | { type: 'UPDATE_FORM'; payload: Partial<PostState['modal']['form']> }
+  | { type: 'SET_SORTING'; payload: string }
+  | { type: 'SET_PAGE'; payload: number }
+  | { type: 'SET_POSTS'; payload: InterfacePost[] }
+  | { type: 'SET_SEARCH'; payload: string };

+const postReducer = (state: PostState, action: PostAction): PostState => {
+  switch (action.type) {
+    // ... reducer cases
+  }
+};

-const [postmodalisOpen, setPostModalIsOpen] = useState(false);
-const [postformState, setPostFormState] = useState({...});
-const [sortingOption, setSortingOption] = useState('None');
-// ... other state variables

+const [state, dispatch] = useReducer(postReducer, initialState);

279-293: Extract PostsRenderer props into a separate interface.

The PostsRenderer component receives many props that should be properly typed.

+interface PostsRendererProps {
+  'data-testid': string;
+  'data-loading': boolean;
+  'data-is-filtering': boolean;
+  'data-sorting-option': string;
+  loading: boolean;
+  error: ApolloError | undefined;
+  data: any; // Replace with proper type
+  isFiltering: boolean;
+  searchTerm: string;
+  sortingOption: string;
+  displayPosts: InterfacePost[];
+}

 const content = (
   <PostsRenderer
-    data-testid="posts-renderer"
-    data-loading={loading}
-    data-is-filtering={isFiltering}
-    data-sorting-option={sortingOption}
-    loading={loading}
-    error={error}
-    data={isFiltering ? data : orgPostListData}
-    isFiltering={isFiltering}
-    searchTerm={searchTerm}
-    sortingOption={sortingOption}
-    displayPosts={displayPosts}
+    {...{
+      'data-testid': 'posts-renderer',
+      'data-loading': loading,
+      'data-is-filtering': isFiltering,
+      'data-sorting-option': sortingOption,
+      loading,
+      error,
+      data: isFiltering ? data : orgPostListData,
+      isFiltering,
+      searchTerm,
+      sortingOption,
+      displayPosts,
+    } as PostsRendererProps}
   />
 );
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2b43c5 and e4626ae.

📒 Files selected for processing (2)
  • src/screens/OrgPost/OrgPost.spec.tsx (1 hunks)
  • src/screens/OrgPost/OrgPost.tsx (8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

2 participants