File size: 393 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
// @flow
import slugg from 'slugg';
import type { ThreadInfoType } from 'shared/graphql/fragments/thread/threadInfo';

const getThreadLink = (thread: ThreadInfoType) => {
  if (!thread.community || !thread.channel) return `/thread/${thread.id}`;
  return `/${thread.community.slug}/${thread.channel.slug}/${slugg(
    thread.content.title
  )}~${thread.id}`;
};

export default getThreadLink;