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

Update CanAccessMessageThreadService #8388

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

bosiraphael
Copy link
Contributor

Trying to fix #7830

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR updates the message thread access control logic by simplifying queries and improving error handling when checking user permissions to access message channels.

  • Replaced Any operator with In in can-access-message-thread.service.ts to prevent errors with empty arrays
  • Combined visibility and ownership checks into a single query with OR conditions in connectedAccountRepository.find()
  • Removed redundant messageChannel repository query and groupBy logic for more efficient access control
  • Added proper type checking for messageChannelMessageAssociations parameter
  • Simplified error handling to only throw ForbiddenException when no matching accounts found

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@charlesBochet charlesBochet merged commit f9a136a into main Nov 7, 2024
19 checks passed
@charlesBochet charlesBochet deleted the update-can-access-message-thread-service branch November 7, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Followup: ApolloError: useFindManyRecords for "messages" not supported
2 participants