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

Function canViewPostAnalytics

packages/shared/src/lib/user.ts:319–331  ·  view source on GitHub ↗
({
  user,
  post,
}: {
  user?: Pick<LoggedUser, 'id' | 'isTeamMember'>;
  post?: { author?: Pick<NonNullable<Post['author']>, 'id'> };
})

Source from the content-addressed store, hash-verified

317};
318
319export const canViewPostAnalytics = ({
320 user,
321 post,
322}: {
323 user?: Pick<LoggedUser, 'id' | 'isTeamMember'>;
324 post?: { author?: Pick<NonNullable<Post['author']>, 'id'> };
325}): boolean => {
326 if (user?.isTeamMember) {
327 return true;
328 }
329
330 return !!user?.id && user.id === post?.author?.id;
331};
332
333export const canViewUserProfileAnalytics = ({
334 user,

Callers 6

ImpressionsChartFunction · 0.90
EngagementRailFunction · 0.90
DiscussionMetaBarFunction · 0.90
PostOptionButtonContentFunction · 0.90
PostAnalyticsPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected