• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alkem-io / client-web / #9048

11 Oct 2024 01:42PM UTC coverage: 5.943%. First build
#9048

Pull #7022

travis-ci

Pull Request #7022: [v0.74.0] Roles API + Unauthenticated Explore page

202 of 10241 branches covered (1.97%)

Branch coverage included in aggregate %.

63 of 431 new or added lines in 60 files covered. (14.62%)

1468 of 17861 relevant lines covered (8.22%)

0.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/domain/community/user/userContributions/useUserContributions.ts
1
import { useUserContributionsQuery } from '@/core/apollo/generated/apollo-hooks';
2
import { RoleSetContributorType, SpaceLevel } from '@/core/apollo/generated/graphql-schema';
3
import { SpaceHostedItem } from '@/domain/space/models/SpaceHostedItem.model';
4
import { useMemo } from 'react';
5

6
const useUserContributions = (userId: string | undefined) => {
7
  const { data } = useUserContributionsQuery({
×
8
    variables: {
×
9
      userId: userId!,
10
    },
11
    skip: !userId,
12
  });
13

14
  return useMemo(() => {
15
    if (!data) {
×
16
      return undefined;
×
17
    }
×
18

19
    const contributions: SpaceHostedItem[] = [];
20

×
21
    data.rolesUser.spaces.forEach(e => {
22
      contributions.push({
×
23
        spaceID: e.id,
×
24
        id: e.id,
25
        spaceLevel: SpaceLevel.L0,
26
        contributorId: userId!,
27
        contributorType: RoleSetContributorType.User,
28
        roles: e.roles,
29
      });
30

31
      e.subspaces.forEach(ss => {
32
        contributions.push({
×
NEW
33
          id: ss.id,
×
34
          spaceID: ss.id,
35
          spaceLevel: ss.level,
36
          contributorId: userId!,
37
          contributorType: RoleSetContributorType.User,
38
          roles: ss.roles,
39
        });
40
      });
41
    });
42

43
    return contributions;
44
  }, [data]);
×
45
};
46

47
export default useUserContributions;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc