File size: 483 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// @flow
import type { GraphQLContext } from '../../';
import type { DBThread } from 'shared/types';

export default async (root: DBThread, _: any, ctx: GraphQLContext) => {
  const { channelId, id } = root;
  const { loaders } = ctx;
  const channel = await loaders.channel.load(channelId);
  if (!channel) {
    console.error(
      'User queried thread of non-existent/deleted channel: ',
      channelId
    );
    console.error('Thread queried: ', id);
  }
  return channel;
};