Skip to content

Commit fcce43b

Browse files
committed
Send message to opporunity leads/admins.
1 parent 877a4b8 commit fcce43b

File tree

7 files changed

+123
-84
lines changed

7 files changed

+123
-84
lines changed

src/core/apollo/generated/apollo-helpers.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,7 @@ export type MutationKeySpecifier = (
15541554
| 'updateTagset'
15551555
| 'updateUser'
15561556
| 'updateUserGroup'
1557+
| 'updateUserPlatformSettings'
15571558
| 'updateVisual'
15581559
| 'updateWhiteboard'
15591560
| 'updateWhiteboardContentRt'
@@ -1715,6 +1716,7 @@ export type MutationFieldPolicy = {
17151716
updateTagset?: FieldPolicy<any> | FieldReadFunction<any>;
17161717
updateUser?: FieldPolicy<any> | FieldReadFunction<any>;
17171718
updateUserGroup?: FieldPolicy<any> | FieldReadFunction<any>;
1719+
updateUserPlatformSettings?: FieldPolicy<any> | FieldReadFunction<any>;
17181720
updateVisual?: FieldPolicy<any> | FieldReadFunction<any>;
17191721
updateWhiteboard?: FieldPolicy<any> | FieldReadFunction<any>;
17201722
updateWhiteboardContentRt?: FieldPolicy<any> | FieldReadFunction<any>;

src/core/apollo/generated/apollo-hooks.ts

+25-25
Original file line numberDiff line numberDiff line change
@@ -11095,23 +11095,23 @@ export const CommunityUserPrivilegesWithParentCommunityDocument = gql`
1109511095
id
1109611096
myPrivileges
1109711097
}
11098-
leadUsers: usersInRole(role: LEAD) {
11098+
}
11099+
challenge(ID: $challengeNameId) @include(if: $includeChallenge) {
11100+
id
11101+
authorization {
1109911102
id
11100-
profile {
11103+
myPrivileges
11104+
}
11105+
community {
11106+
id
11107+
myMembershipStatus
11108+
authorization {
1110111109
id
11102-
displayName
11103-
avatar: visual(type: AVATAR) {
11104-
...VisualUri
11105-
}
11106-
location {
11107-
id
11108-
country
11109-
city
11110-
}
11110+
myPrivileges
1111111111
}
1111211112
}
1111311113
}
11114-
challenge(ID: $challengeNameId) @include(if: $includeChallenge) {
11114+
opportunity(ID: $opportunityNameId) @include(if: $includeOpportunity) {
1111511115
id
1111611116
authorization {
1111711117
id
@@ -11139,20 +11139,20 @@ export const CommunityUserPrivilegesWithParentCommunityDocument = gql`
1113911139
}
1114011140
}
1114111141
}
11142-
}
11143-
}
11144-
opportunity(ID: $opportunityNameId) @include(if: $includeOpportunity) {
11145-
id
11146-
authorization {
11147-
id
11148-
myPrivileges
11149-
}
11150-
community {
11151-
id
11152-
myMembershipStatus
11153-
authorization {
11142+
adminUsers: usersInRole(role: ADMIN) {
1115411143
id
11155-
myPrivileges
11144+
profile {
11145+
id
11146+
displayName
11147+
avatar: visual(type: AVATAR) {
11148+
...VisualUri
11149+
}
11150+
location {
11151+
id
11152+
country
11153+
city
11154+
}
11155+
}
1115611156
}
1115711157
}
1115811158
}

src/core/apollo/generated/graphql-schema.ts

+40-26
Original file line numberDiff line numberDiff line change
@@ -2795,6 +2795,8 @@ export type Mutation = {
27952795
updateUser: User;
27962796
/** Updates the specified User Group. */
27972797
updateUserGroup: UserGroup;
2798+
/** Update the platform settings, such as nameID, email, for the specified User. */
2799+
updateUserPlatformSettings: User;
27982800
/** Updates the image URI for the specified Visual. */
27992801
updateVisual: Visual;
28002802
/** Updates the specified Whiteboard. */
@@ -3387,6 +3389,10 @@ export type MutationUpdateUserGroupArgs = {
33873389
userGroupData: UpdateUserGroupInput;
33883390
};
33893391

3392+
export type MutationUpdateUserPlatformSettingsArgs = {
3393+
updateData: UpdateUserPlatformSettingsInput;
3394+
};
3395+
33903396
export type MutationUpdateVisualArgs = {
33913397
updateData: UpdateVisualInput;
33923398
};
@@ -5425,6 +5431,14 @@ export type UpdateUserInput = {
54255431
serviceProfile?: InputMaybe<Scalars['Boolean']>;
54265432
};
54275433

5434+
export type UpdateUserPlatformSettingsInput = {
5435+
email?: InputMaybe<Scalars['String']>;
5436+
/** Upate the URL path for the User. */
5437+
nameID?: InputMaybe<Scalars['NameID']>;
5438+
/** The identifier for the User whose platform managed information is to be updated. */
5439+
userID: Scalars['String'];
5440+
};
5441+
54285442
export type UpdateUserPreferenceInput = {
54295443
/** Type of the user preference */
54305444
type: UserPreferenceType;
@@ -17533,19 +17547,6 @@ export type CommunityUserPrivilegesWithParentCommunityQuery = {
1753317547
authorization?:
1753417548
| { __typename?: 'Authorization'; id: string; myPrivileges?: Array<AuthorizationPrivilege> | undefined }
1753517549
| undefined;
17536-
leadUsers?:
17537-
| Array<{
17538-
__typename?: 'User';
17539-
id: string;
17540-
profile: {
17541-
__typename?: 'Profile';
17542-
id: string;
17543-
displayName: string;
17544-
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
17545-
location?: { __typename?: 'Location'; id: string; country: string; city: string } | undefined;
17546-
};
17547-
}>
17548-
| undefined;
1754917550
}
1755017551
| undefined;
1755117552
challenge?: {
@@ -17562,19 +17563,6 @@ export type CommunityUserPrivilegesWithParentCommunityQuery = {
1756217563
authorization?:
1756317564
| { __typename?: 'Authorization'; id: string; myPrivileges?: Array<AuthorizationPrivilege> | undefined }
1756417565
| undefined;
17565-
leadUsers?:
17566-
| Array<{
17567-
__typename?: 'User';
17568-
id: string;
17569-
profile: {
17570-
__typename?: 'Profile';
17571-
id: string;
17572-
displayName: string;
17573-
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
17574-
location?: { __typename?: 'Location'; id: string; country: string; city: string } | undefined;
17575-
};
17576-
}>
17577-
| undefined;
1757817566
}
1757917567
| undefined;
1758017568
};
@@ -17592,6 +17580,32 @@ export type CommunityUserPrivilegesWithParentCommunityQuery = {
1759217580
authorization?:
1759317581
| { __typename?: 'Authorization'; id: string; myPrivileges?: Array<AuthorizationPrivilege> | undefined }
1759417582
| undefined;
17583+
leadUsers?:
17584+
| Array<{
17585+
__typename?: 'User';
17586+
id: string;
17587+
profile: {
17588+
__typename?: 'Profile';
17589+
id: string;
17590+
displayName: string;
17591+
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
17592+
location?: { __typename?: 'Location'; id: string; country: string; city: string } | undefined;
17593+
};
17594+
}>
17595+
| undefined;
17596+
adminUsers?:
17597+
| Array<{
17598+
__typename?: 'User';
17599+
id: string;
17600+
profile: {
17601+
__typename?: 'Profile';
17602+
id: string;
17603+
displayName: string;
17604+
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
17605+
location?: { __typename?: 'Location'; id: string; country: string; city: string } | undefined;
17606+
};
17607+
}>
17608+
| undefined;
1759517609
}
1759617610
| undefined;
1759717611
};

src/core/i18n/en/translation.en.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,8 @@
12131213
"short": "Please join parent Challenge first"
12141214
},
12151215
"contactChallengeLeads": {
1216-
"full": "Send a message to Challenge leads to become a member",
1217-
"short": "Send a message to Challenge leads to become a member"
1216+
"full": "Send a message to Opportunity leads to become a member",
1217+
"short": "Send a message to Opportunity leads to become a member"
12181218
},
12191219
"goToSpace": "Go to $t(common.space)",
12201220
"goToChallenge": "Go to $t(common.challenge)",

src/domain/community/application/applicationButton/OpportunityApplicationButton.tsx

+17-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ export interface OpportunityApplicationButtonProps {
1212
isMember: boolean;
1313
isParentMember?: boolean;
1414
parentUrl?: string;
15-
parentLeadUsers: {
15+
leadUsers: {
16+
id: string;
17+
displayName?: string;
18+
city?: string;
19+
country?: string;
20+
avatarUri?: string;
21+
}[];
22+
adminUsers: {
1623
id: string;
1724
displayName?: string;
1825
city?: string;
@@ -34,7 +41,8 @@ export const OpportunityApplicationButton = forwardRef<
3441
isMember = false,
3542
isParentMember = false,
3643
parentUrl,
37-
parentLeadUsers,
44+
leadUsers,
45+
adminUsers,
3846
loading = false,
3947
component: Button = MuiButton,
4048
extended = false,
@@ -46,8 +54,10 @@ export const OpportunityApplicationButton = forwardRef<
4654
dialogTitle: t('send-message-dialog.direct-message-title'),
4755
});
4856

57+
const contactUsers = leadUsers.length > 0 ? leadUsers : adminUsers;
58+
4959
const handleSendMessageToParentLeads = () => {
50-
sendMessage('user', ...parentLeadUsers);
60+
sendMessage('user', ...contactUsers);
5161
};
5262

5363
const renderApplicationButton = () => {
@@ -89,6 +99,10 @@ export const OpportunityApplicationButton = forwardRef<
8999
);
90100
}
91101

102+
if (contactUsers.length === 0) {
103+
return null;
104+
}
105+
92106
return (
93107
<Button
94108
ref={ref as Ref<HTMLButtonElement>}

src/domain/community/application/containers/OpportunityApplicationButtonContainer.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,16 @@ export const OpportunityApplicationButtonContainer: FC<OpportunityApplicationBut
4747
_communityPrivileges?.space?.challenge?.community?.myMembershipStatus === CommunityMembershipStatus.Member;
4848

4949
const parentUrl = challengeNameId ? buildChallengeUrl(spaceNameId, challengeNameId) : buildSpaceUrl(spaceNameId);
50-
const parentCommunityLeadUsers = _communityPrivileges?.space?.challenge?.community?.leadUsers ?? [];
51-
const parentLeadUsers = parentCommunityLeadUsers?.map(user => ({
50+
const communityLeadUsers = _communityPrivileges?.space?.opportunity?.community?.leadUsers ?? [];
51+
const communityAdminUsers = _communityPrivileges?.space?.opportunity?.community?.adminUsers ?? [];
52+
const leadUsers = communityLeadUsers.map(user => ({
53+
id: user.id,
54+
displayName: user.profile.displayName,
55+
country: user.profile.location?.country,
56+
city: user.profile.location?.city,
57+
avatarUri: user.profile.avatar?.uri,
58+
}));
59+
const adminUsers = communityAdminUsers.map(user => ({
5260
id: user.id,
5361
displayName: user.profile.displayName,
5462
country: user.profile.location?.country,
@@ -62,7 +70,8 @@ export const OpportunityApplicationButtonContainer: FC<OpportunityApplicationBut
6270
isAuthenticated,
6371
isMember,
6472
isParentMember,
65-
parentLeadUsers,
73+
leadUsers,
74+
adminUsers,
6675
parentUrl,
6776
loading,
6877
};

src/domain/community/application/containers/communityUserPrivilegesWithParentCommunity.graphql

+25-25
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ query communityUserPrivilegesWithParentCommunity(
1515
id
1616
myPrivileges
1717
}
18-
leadUsers: usersInRole(role: LEAD) {
18+
}
19+
challenge(ID: $challengeNameId) @include(if: $includeChallenge) {
20+
id
21+
authorization {
1922
id
20-
profile {
23+
myPrivileges
24+
}
25+
community {
26+
id
27+
myMembershipStatus
28+
authorization {
2129
id
22-
displayName
23-
avatar: visual(type: AVATAR) {
24-
...VisualUri
25-
}
26-
location {
27-
id
28-
country
29-
city
30-
}
30+
myPrivileges
3131
}
3232
}
3333
}
34-
challenge(ID: $challengeNameId) @include(if: $includeChallenge) {
34+
opportunity(ID: $opportunityNameId) @include(if: $includeOpportunity) {
3535
id
3636
authorization {
3737
id
@@ -59,20 +59,20 @@ query communityUserPrivilegesWithParentCommunity(
5959
}
6060
}
6161
}
62-
}
63-
}
64-
opportunity(ID: $opportunityNameId) @include(if: $includeOpportunity) {
65-
id
66-
authorization {
67-
id
68-
myPrivileges
69-
}
70-
community {
71-
id
72-
myMembershipStatus
73-
authorization {
62+
adminUsers: usersInRole(role: ADMIN) {
7463
id
75-
myPrivileges
64+
profile {
65+
id
66+
displayName
67+
avatar: visual(type: AVATAR) {
68+
...VisualUri
69+
}
70+
location {
71+
id
72+
country
73+
city
74+
}
75+
}
7676
}
7777
}
7878
}

0 commit comments

Comments
 (0)