File size: 513 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// @flow
import type { DBChannel } from 'shared/types';
import type { GraphQLContext } from '../../';
import { canModerateChannel } from '../../utils/permissions';
export default async ({ id }: DBChannel, _: any, ctx: GraphQLContext) => {
const { user: currentUser, loaders } = ctx;
if (!currentUser) return null;
if (!(await canModerateChannel(currentUser.id, id, loaders))) {
return null;
}
return loaders.channelSettings.load(id).then(settings => {
return settings.joinSettings;
});
};
|