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

Function canViewPostAnalytics

packages/shared/src/lib/user.ts:387–399  ·  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

385};
386
387export const canViewPostAnalytics = ({
388 user,
389 post,
390}: {
391 user?: Pick<LoggedUser, 'id' | 'isTeamMember'>;
392 post?: { author?: Pick<NonNullable<Post['author']>, 'id'> };
393}): boolean => {
394 if (user?.isTeamMember) {
395 return true;
396 }
397
398 return !!user?.id && user.id === post?.author?.id;
399};
400
401export const canViewUserProfileAnalytics = ({
402 user,

Callers 6

ImpressionsChartFunction · 0.90
EngagementRailFunction · 0.90
PostOptionButtonContentFunction · 0.90
usePostImpressionsFunction · 0.90
PostAnalyticsPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected