MCPcopy Create free account
hub / github.com/dailydotdev/apps / getChatRoomHref

Function getChatRoomHref

packages/shared/src/features/liveChat/joinLink.ts:27–39  ·  view source on GitHub ↗
(
  room: Pick<ChatRoom, 'id' | 'type'> & {
    post?: { commentsPermalink?: string } | null;
  },
)

Source from the content-addressed store, hash-verified

25// a post room to the post, joining on landing. Undefined for a post room
26// whose post is not known, which has nowhere to go.
27export const getChatRoomHref = (
28 room: Pick<ChatRoom, 'id' | 'type'> & {
29 post?: { commentsPermalink?: string } | null;
30 },
31): string | undefined => {
32 if (room.type === ChatRoomType.Topic) {
33 return `${webappUrl}${getChatRoomPath(room.id).slice(1)}`;
34 }
35
36 return room.post?.commentsPermalink
37 ? withJoinIntent(room.post.commentsPermalink)
38 : undefined;
39};
40
41// Where the daily.dev team opens a chat on a topic. Absolute, like the
42// room links, since the widget renders in the extension too.

Callers 5

RoomRowFunction · 0.90
joinLink.spec.tsFile · 0.90
LiveChatHighlightRowFunction · 0.90
LiveChatHighlightCardRowFunction · 0.90
useLiveChatHighlightFunction · 0.90

Calls 2

getChatRoomPathFunction · 0.85
withJoinIntentFunction · 0.85

Tested by

no test coverage detected