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

Commit

Permalink
Bugfix for channel-user not existing yet for instance channel
Browse files Browse the repository at this point in the history
  • Loading branch information
barankyle committed Aug 31, 2023
1 parent 307f0d4 commit 9c184b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/client-core/src/social/services/ChannelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export const ChannelService = {
})
channelState.merge({ messageCreated: true })
} catch (err) {
//Occasionally, the client attempts to fetch the instance's channel after it's been created, but before the user's
//channel-user has been created, which occurs when connecting to the instance server.
//If it's a 403, it is almost definitely because of this issue, so just wait a second and try again.
if (err.code == 403) return setTimeout(() => ChannelService.getInstanceChannel(), 1000)
NotificationService.dispatchNotify(err.message, { variant: 'error' })
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export default () => {
if (channel == null) {
throw new BadRequest('Invalid channel ID')
}
const partyUser = await app.service('channel-user').Model.findOne({
const channelUser = await app.service('channel-user').Model.findOne({
where: {
channelId: channel.id,
userId: userId
}
})
if (partyUser == null) {
if (channelUser == null) {
throw new Forbidden('You are not a member of that channel')
}
return context
Expand Down

0 comments on commit 9c184b1

Please sign in to comment.