Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7d36974
#1499 | Add util for checking preferred name
William-Edwards-STFC Apr 24, 2026
715c814
#1499 | Use preferred name in eventloglist
William-Edwards-STFC Apr 24, 2026
4b193c6
#1499 | Replace name check in FapMembers
William-Edwards-STFC Apr 24, 2026
b699a42
#1499 | Use utils for preferred name check in assignfapmembertopropos…
William-Edwards-STFC Apr 24, 2026
4da37ad
#1499 | Use utils to replace preferredname check in FapAssignedReview…
William-Edwards-STFC Apr 24, 2026
fb89258
#1499 | Use utils to check preferredname in MultiRankAssignmentDialog
William-Edwards-STFC Apr 24, 2026
0c63a0b
#1499 | Use utils to replace preferredname check in ProposalTableInst…
William-Edwards-STFC Apr 24, 2026
5286a2c
#1499 | Use utils to replace preferredname check in ProposalTableOfficer
William-Edwards-STFC Apr 24, 2026
3e59b40
#1499 | Replace preferredname check in TechniqueProposalTable
William-Edwards-STFC Apr 24, 2026
4f987da
Merge branch 'develop' into 1499-name-change
yoganandaness May 11, 2026
87ef1b9
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC May 12, 2026
0fac230
Merge branch 'develop' into 1499-name-change
mutambaraf May 13, 2026
b69e0d0
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC May 26, 2026
13341bf
#1499 | Make preferredname optional
William-Edwards-STFC May 26, 2026
3f8ad27
Merge branch '1499-name-change' of https://github.com/UserOfficeProje…
William-Edwards-STFC May 26, 2026
0eb16bd
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC May 26, 2026
a94ba1d
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC May 27, 2026
f62b642
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC Jun 4, 2026
2abf28b
Add preferredname to initialDBData
William-Edwards-STFC Jun 4, 2026
a84f269
#1499 | Fix the tests
William-Edwards-STFC Jun 4, 2026
785d8ac
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC Jun 4, 2026
51f0022
#1499 | Fix linter
William-Edwards-STFC Jun 4, 2026
990810e
Merge branch '1499-name-change' of https://github.com/UserOfficeProje…
William-Edwards-STFC Jun 4, 2026
74d78df
Merge branch 'develop' into 1499-name-change
jekabs-karklins Jun 4, 2026
e008928
#1499 | Remove extra preferrednames as they aren't actually needed
William-Edwards-STFC Jun 5, 2026
ade92cc
Merge branch '1499-name-change' of https://github.com/UserOfficeProje…
William-Edwards-STFC Jun 5, 2026
0b86fb5
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC Jun 5, 2026
3d52120
#1499 | Add preferredname for Carl
William-Edwards-STFC Jun 5, 2026
0c12dd8
Merge branch '1499-name-change' of https://github.com/UserOfficeProje…
William-Edwards-STFC Jun 5, 2026
c361d13
#1499 | Update generalfaps test to use preferred name if one exists a…
William-Edwards-STFC Jun 5, 2026
8cddfe5
#1499 | Add preferredname check to instrument test
William-Edwards-STFC Jun 5, 2026
0154d36
#1499 | Fix linter
William-Edwards-STFC Jun 5, 2026
a4c5d8b
Add preferred name check to test
William-Edwards-STFC Jun 5, 2026
cdc029e
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC Jun 5, 2026
658ae52
Merge branch 'develop' into 1499-name-change
William-Edwards-STFC Jun 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 12 additions & 33 deletions apps/e2e/cypress/e2e/generalFaps.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,10 @@ context('General facility access panel tests', () => {
cy.get('[role="dialog"] table tbody tr')
.first()
.find('td.MuiTableCell-alignLeft')
.first()
.then((element) => {
selectedChairUserFirstName = element.text();
});

cy.get('[role="dialog"] table tbody tr')
.first()
.find('td.MuiTableCell-alignLeft')
.eq(1)
.then((element) => {
selectedChairUserLastName = element.text();
.then((cells) => {
const preferredName = cells.eq(2).text().trim();
selectedChairUserFirstName = preferredName || cells.eq(0).text();
selectedChairUserLastName = cells.eq(1).text();
});

cy.get('[aria-label="Select user"]').first().click();
Expand Down Expand Up @@ -278,17 +271,10 @@ context('General facility access panel tests', () => {
cy.get('[role="dialog"] table tbody tr')
.first()
.find('td.MuiTableCell-alignLeft')
.first()
.then((element) => {
selectedSecretaryUserFirstName = element.text();
});

cy.get('[role="dialog"] table tbody tr')
.first()
.find('td.MuiTableCell-alignLeft')
.eq(1)
.then((element) => {
selectedSecretaryUserLastName = element.text();
.then((cells) => {
const preferredName = cells.eq(2).text().trim();
selectedSecretaryUserFirstName = preferredName || cells.eq(0).text();
selectedSecretaryUserLastName = cells.eq(1).text();
});

cy.get('[aria-label="Select user"]').first().click();
Expand Down Expand Up @@ -321,17 +307,10 @@ context('General facility access panel tests', () => {
cy.get('[role="dialog"] table tbody tr')
.first()
.find('td.MuiTableCell-alignLeft')
.first()
.then((element) => {
selectedSecretaryUserFirstName = element.text();
});

cy.get('[role="dialog"] table tbody tr')
.first()
.find('td.MuiTableCell-alignLeft')
.eq(1)
.then((element) => {
selectedSecretaryUserLastName = element.text();
.then((cells) => {
const preferredName = cells.eq(2).text().trim();
selectedSecretaryUserFirstName = preferredName || cells.eq(0).text();
selectedSecretaryUserLastName = cells.eq(1).text();
});

cy.get('[aria-label="Select user"]').first().click();
Expand Down
26 changes: 17 additions & 9 deletions apps/e2e/cypress/e2e/instruments.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ context('Instrument tests', () => {

cy.get('[data-cy="user-list"] input').should(
'have.value',
`${scientist1.firstName} ${scientist1.lastName}`
`${scientist1.preferredName} ${scientist1.lastName}`
);

cy.get('[data-cy="user-list"]').click();
Expand All @@ -545,16 +545,22 @@ context('Instrument tests', () => {
'have.length',
numberOfScientistsAndManagerAssignedToCreatedInstrument
);
const reassignDisplayName = featureFlags
.getEnabledFeatures()
.get(FeatureId.USER_SEARCH_FILTER)
? scientist2.preferredName
: scientist2.firstName;

cy.get('[title="user-list-options"]')
.contains(scientist2.firstName)
.contains(reassignDisplayName)
.click();

cy.get('[data-cy="re-assign-submit"]').click();
cy.get('[data-cy="confirm-ok"]').click();

cy.notification({
variant: 'success',
text: `Assigned to ${scientist2.firstName} ${scientist2.lastName}`,
text: `Assigned to ${reassignDisplayName} ${scientist2.lastName}`,
});

cy.closeModal();
Expand Down Expand Up @@ -962,10 +968,12 @@ context('Instrument tests', () => {
instrumentId: createdInstrumentId,
questionaryId: initialDBData.technicalReview.questionaryId,
});
let updatedContact = `${scientist2.firstName} ${scientist2.lastName} (${scientist2.email})`;
if (featureFlags.getEnabledFeatures().get(FeatureId.USER_SEARCH_FILTER)) {
updatedContact = `${scientist2.firstName.slice(0, 3)} ${scientist2.lastName} (${scientist2.email})`;
}
const contactDisplayName = featureFlags
.getEnabledFeatures()
.get(FeatureId.USER_SEARCH_FILTER)
? scientist2.preferredName
: scientist2.firstName;
const updatedContact = `${contactDisplayName} ${scientist2.lastName} (${scientist2.email})`;
cy.login('officer', initialDBData.roles.userOfficer);
cy.visit('/');

Expand Down Expand Up @@ -1009,7 +1017,7 @@ context('Instrument tests', () => {
cy.get('[data-cy="confirm-ok"]').click();

cy.get('[aria-label="Detail panel visibility toggle"]').eq(0).click();
cy.contains(`${scientist2.firstName} ${scientist2.lastName}`).should(
cy.contains(`${contactDisplayName} ${scientist2.lastName}`).should(
'be.visible'
);

Expand All @@ -1026,7 +1034,7 @@ context('Instrument tests', () => {

cy.get('[role="dialog"]').contains('Technical review').click();

cy.contains(`${scientist2.firstName} ${scientist2.lastName}`).should(
cy.contains(`${contactDisplayName} ${scientist2.lastName}`).should(
'not.exist'
);
});
Expand Down
12 changes: 8 additions & 4 deletions apps/e2e/cypress/e2e/internalReviews.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ context('Internal Review tests', () => {
}

cy.get('[data-cy="internal-reviewer-options"]')
.contains(scientist2.firstName)
.contains(scientist2.preferredName)
.click();

cy.setTinyMceContent('internal_review_comment', comment);
Expand All @@ -170,7 +170,9 @@ context('Internal Review tests', () => {
cy.notification({ variant: 'success', text: 'success' });

cy.get('[data-cy="internal-reviews-table"]').contains(title);
cy.get('[data-cy="internal-reviews-table"]').contains(scientist2.firstName);
cy.get('[data-cy="internal-reviews-table"]').contains(
scientist2.preferredName
);
});

it('User Officer should be able to update an internal review', () => {
Expand Down Expand Up @@ -227,15 +229,17 @@ context('Internal Review tests', () => {
.click();

cy.get('[data-cy="internal-reviewer-options"]')
.contains(scientist2.firstName)
.contains(scientist2.preferredName)
.click();

cy.get('[data-cy="create-modal"]').find('[data-cy="submit"]').click();

cy.notification({ variant: 'success', text: 'success' });

cy.get('[data-cy="internal-reviews-table"]').contains(newTitle);
cy.get('[data-cy="internal-reviews-table"]').contains(scientist2.firstName);
cy.get('[data-cy="internal-reviews-table"]').contains(
scientist2.preferredName
);
});

it('User Officer should be able to delete internal review', () => {
Expand Down
2 changes: 2 additions & 0 deletions apps/e2e/cypress/support/initialDBData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export default {
user1: {
id: 1,
firstName: 'Carl',
preferredName: 'Carl',
lastName: 'Carlsson',
email: 'Javon4@hotmail.com',
password: 'Test1234!',
Expand All @@ -261,6 +262,7 @@ export default {
id: 4,
firstName: 'Benjamin',
lastName: 'Beckley',
preferredName: 'Ben',
email: 'ben@inbox.com',
password: 'Test1234!',
},
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/src/components/eventLog/EventLogList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { EventLog } from 'generated/sdk';
import { useFormattedDateTime } from 'hooks/admin/useFormattedDateTime';
import { useEventLogsData } from 'hooks/eventLog/useEventLogsData';
import { tableIcons } from 'utils/materialIcons';
import { getPreferredName } from 'utils/user';

type EventLogListProps = {
/** Id of the changed object that we want to list event logs for. */
Expand All @@ -25,7 +26,7 @@ const columns: Column<EventLog>[] = [
title: 'Changed by',
render: (rowData: EventLog): string =>
rowData.changedBy
? `${rowData.changedBy.firstname} ${rowData.changedBy.lastname}`
? `${getPreferredName(rowData.changedBy)} ${rowData.changedBy.lastname}`
: 'System',
},
{
Expand Down
7 changes: 2 additions & 5 deletions apps/frontend/src/components/fap/Members/FapMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { useRenewToken } from 'hooks/common/useRenewToken';
import { FapMember, useFapReviewersData } from 'hooks/fap/useFapReviewersData';
import { tableIcons } from 'utils/materialIcons';
import useDataApiWithFeedback from 'utils/useDataApiWithFeedback';
import { getFullUserName } from 'utils/user';
import { getFullUserName, getPreferredName } from 'utils/user';
import withConfirm, { WithConfirmType } from 'utils/withConfirm';

type BasicUserDetailsWithRole = BasicUserDetails & { roleId: UserRole };
Expand All @@ -45,10 +45,7 @@ type FapMembersProps = {
const columns = [
{
title: 'Name',
render: (rowData: FapMember) =>
rowData.user.preferredname
? rowData.user.preferredname
: rowData.user.firstname,
render: (rowData: FapMember) => getPreferredName(rowData.user),
},
{
title: 'Surname',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React, { useEffect, useState } from 'react';
import PeopleTable from 'components/user/PeopleTable';
import { BasicUserDetails, Maybe, Role } from 'generated/sdk';
import { useFapMembersData } from 'hooks/fap/useFapMembersData';
import { getPreferredName } from 'utils/user';

import { MultiRankAssignmentDialog } from './MultiRankAssignmentDialog';

Expand All @@ -31,8 +32,7 @@ const memberRole = (member: FapAssignedMember) => `${member.role?.title}`;
const columns = [
{
title: 'Name',
render: (rowData: FapAssignedMember) =>
rowData.preferredname ? rowData.preferredname : rowData.firstname,
render: (rowData: FapAssignedMember) => getPreferredName(rowData),
},
{ title: 'Surname', field: 'lastname' },
{ title: 'Proposal Count', field: 'proposalsCountByCall' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from 'hooks/fap/useFapProposalsData';
import { tableIcons } from 'utils/materialIcons';
import useDataApiWithFeedback from 'utils/useDataApiWithFeedback';
import { getPreferredName } from 'utils/user';

import RankInputModal from './RankInputModal';

Expand Down Expand Up @@ -107,11 +108,7 @@ const FapAssignedReviewersTable = ({
{
title: 'First name',
render: (rowData: FapProposalAssignmentType) =>
rowData.user
? rowData.user.preferredname
? rowData.user.preferredname
: rowData.user.firstname
: '-',
rowData.user ? getPreferredName(rowData.user) : '-',
},
{
title: 'Last name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useTheme } from '@mui/material/styles';
import React, { ChangeEvent } from 'react';

import { BasicUserDetails } from 'generated/sdk';
import { getPreferredName } from 'utils/user';

import { FapAssignedMember } from './AssignFapMemberToProposalModal';

Expand Down Expand Up @@ -94,7 +95,7 @@ export const MultiRankAssignmentDialog = ({
}}
>
<TableCell component="th" scope="row">
{row.preferredname ? row.preferredname : row.firstname}
{getPreferredName(row)}
</TableCell>
<TableCell align="left">{row.lastname}</TableCell>
<TableCell align="right">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
} from 'utils/helperFunctions';
import { tableIcons } from 'utils/materialIcons';
import useDataApiWithFeedback from 'utils/useDataApiWithFeedback';
import { getFullUserName } from 'utils/user';
import { getFullUserName, getPreferredName } from 'utils/user';
import withConfirm, { WithConfirmType } from 'utils/withConfirm';

import ProposalAttachmentDownload from './ProposalAttachmentDownload';
Expand Down Expand Up @@ -110,21 +110,10 @@ let columns: Column<ProposalViewData>[] = [
title: 'Principal Investigator',
field: 'principalInvestigator',
emptyValue: '-',
render: (proposalView) => {
if (
proposalView.principalInvestigator?.lastname &&
proposalView.principalInvestigator?.preferredname
) {
return `${proposalView.principalInvestigator.lastname}, ${proposalView.principalInvestigator.preferredname}`;
} else if (
proposalView.principalInvestigator?.lastname &&
proposalView.principalInvestigator?.firstname
) {
return `${proposalView.principalInvestigator.lastname}, ${proposalView.principalInvestigator.firstname}`;
}

return '';
},
render: (proposalView) =>
proposalView.principalInvestigator?.lastname
? `${proposalView.principalInvestigator.lastname}, ${getPreferredName(proposalView.principalInvestigator)}`
: '',
},
{
title: 'PI Email',
Expand Down
21 changes: 5 additions & 16 deletions apps/frontend/src/components/proposal/ProposalTableOfficer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import {
} from 'utils/helperFunctions';
import { tableIcons } from 'utils/materialIcons';
import useDataApiWithFeedback from 'utils/useDataApiWithFeedback';
import { getFullUserName } from 'utils/user';
import { getFullUserName, getPreferredName } from 'utils/user';
import withConfirm, { WithConfirmType } from 'utils/withConfirm';

import CallSelectModalOnProposalsClone from './CallSelectModalOnProposalClone';
Expand Down Expand Up @@ -129,21 +129,10 @@ let columns: Column<ProposalViewData>[] = [
field: 'principalInvestigator',
sorting: false,
emptyValue: '-',
render: (proposalView) => {
if (
proposalView.principalInvestigator?.lastname &&
proposalView.principalInvestigator?.preferredname
) {
return `${proposalView.principalInvestigator.lastname}, ${proposalView.principalInvestigator.preferredname}`;
} else if (
proposalView.principalInvestigator?.lastname &&
proposalView.principalInvestigator?.firstname
) {
return `${proposalView.principalInvestigator.lastname}, ${proposalView.principalInvestigator.firstname}`;
}

return '';
},
render: (proposalView) =>
proposalView.principalInvestigator?.lastname
? `${proposalView.principalInvestigator.lastname}, ${getPreferredName(proposalView.principalInvestigator)}`
: '',
},
{
title: 'PI Email',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
} from 'utils/helperFunctions';
import { tableIcons } from 'utils/materialIcons';
import useDataApiWithFeedback from 'utils/useDataApiWithFeedback';
import { getPreferredName } from 'utils/user';
import withConfirm, { WithConfirmType } from 'utils/withConfirm';

import ProposalScientistComment from './ProposalScientistComment';
Expand Down Expand Up @@ -284,11 +285,7 @@ const TechniqueProposalTable = ({ confirm }: { confirm: WithConfirmType }) => {
sorting: false,
render: (proposalView: ProposalViewData) => {
if (proposalView.principalInvestigator?.lastname) {
if (proposalView.principalInvestigator?.preferredname) {
return `${proposalView.principalInvestigator.lastname}, ${proposalView.principalInvestigator.preferredname}`;
} else if (proposalView.principalInvestigator?.firstname) {
return `${proposalView.principalInvestigator.lastname}, ${proposalView.principalInvestigator.firstname}`;
}
return `${proposalView.principalInvestigator.lastname}, ${getPreferredName(proposalView.principalInvestigator)}`;
}

return '';
Expand Down
Loading
Loading