Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Changes to use hooks and resolvers instead of custom class for channel service #8910

Merged
merged 28 commits into from
Oct 3, 2023

Conversation

hanzlamateen
Copy link
Member

@hanzlamateen hanzlamateen commented Sep 27, 2023

Summary

🤖 Generated by Copilot at 0513acb

This pull request enhances the channel service with new hooks to check user permissions and relationships before allowing channel operations. It also improves the error handling and code readability of the existing hooks by using feathersjs error classes and the new hooks. The changes affect the file packages/server-core/src/social/channel/channel.hooks.ts.

References

#8871

Explanation

🤖 Generated by Copilot at 0513acb

  • Add new hooks to check user permissions and relationships for channel service (link, link, link)
  • Import BadRequest and Forbidden error classes from feathersjs/errors (link)
  • Define ensureUserHasChannelAccess hook to verify that the user is either the channel owner or a channel member (link)
  • Define ensureUsersFriendWithOwner hook to verify that the user is a friend of the channel owner or the owner themselves (link)
  • Use existing services and types from channel module and document hooks with comments (link)
  • Replace inline hook functions in get and create methods of channel service with the new hooks (link)
  • Apply hooks only when the provider is external (link)

🤖 Generated by Copilot at 0513acb

Sing, O Muse, of the channel service, the cunning work of code
That by new hooks enforced the rules of access and of friendship
For those who sought to join or make a channel of their own
And of the wise refactorer, who used the feathered errors

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

@hanzlamateen hanzlamateen marked this pull request as ready for review September 29, 2023 06:48
@hanzlamateen hanzlamateen merged commit e23db47 into dev Oct 3, 2023
12 of 13 checks passed
@hanzlamateen hanzlamateen deleted the channel-hooks-refactor branch October 3, 2023 05:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants