Skip to content

Commit

Permalink
Merge pull request #1234 from w3c/releases
Browse files Browse the repository at this point in the history
October 9, 2024 Production Release

Includes changes recently included in the [releases branch](https://github.com/w3c/aria-at-app/tree/releases) through #1233.

[Latest CHANGELOG.md update: v1.9.0](https://github.com/w3c/aria-at-app/blob/releases/CHANGELOG.md#190-2024-10-09)
  • Loading branch information
howard-e authored Oct 9, 2024
2 parents 553c905 + 19074d1 commit 1f87b26
Show file tree
Hide file tree
Showing 53 changed files with 6,250 additions and 812 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [1.9.0](https://github.com/w3c/aria-at-app/compare/v1.8.1...v1.9.0) (2024-10-09)


### Features

* Vendor verification ([#1208](https://github.com/w3c/aria-at-app/issues/1208)) ([b8b13d4](https://github.com/w3c/aria-at-app/commit/b8b13d48a5e05e31613bfea54678a30b525d18c6))


### Bug Fixes

* Add tests for retry cancelled collection jobs ([#1214](https://github.com/w3c/aria-at-app/issues/1214)) ([34d7aac](https://github.com/w3c/aria-at-app/commit/34d7aac53492b5077fe487ef51e2a7bd5c536afc))
* Assertion with EXCLUDE priority causing test result submit errors ([#1229](https://github.com/w3c/aria-at-app/issues/1229)) ([d7cc1fd](https://github.com/w3c/aria-at-app/commit/d7cc1fd6efe3a72b3df6158a5d1fb9580f3f6de2))

### [1.8.1](https://github.com/w3c/aria-at-app/compare/v1.8.0...v1.8.1) (2024-09-23)


Expand Down
45 changes: 33 additions & 12 deletions client/components/CandidateReview/TestPlans/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import ClippedProgressBar from '@components/common/ClippedProgressBar';
import { dates } from 'shared';
import './TestPlans.css';
import { calculations } from 'shared';
import { UserPropType } from '../../common/proptypes';

const FullHeightContainer = styled(Container)`
min-height: calc(100vh - 64px);
Expand Down Expand Up @@ -177,7 +178,7 @@ const None = styled.span`
}
`;

const TestPlans = ({ testPlanVersions }) => {
const TestPlans = ({ testPlanVersions, me }) => {
const [atExpandTableItems, setAtExpandTableItems] = useState({
1: true,
2: true,
Expand Down Expand Up @@ -503,20 +504,39 @@ const TestPlans = ({ testPlanVersions }) => {
.filter(t => t.isCandidateReview === true)
.filter(t => uniqueFilter(t, uniqueLinks, 'link'));

const canReview =
me.roles.includes('ADMIN') ||
(me.roles.includes('VENDOR') &&
me.company.ats.some(at => at.id === atId));

const getTitleEl = () => {
if (canReview) {
return (
<Link
to={`/candidate-test-plan/${testPlanVersion.id}/${atId}`}
>
{getTestPlanVersionTitle(testPlanVersion, {
includeVersionString: true
})}{' '}
({testsCount} Test
{testsCount === 0 || testsCount > 1 ? `s` : ''})
</Link>
);
}
return (
<>
{getTestPlanVersionTitle(testPlanVersion, {
includeVersionString: true
})}{' '}
({testsCount} Test
{testsCount === 0 || testsCount > 1 ? `s` : ''})
</>
);
};
return (
dataExists && (
<tr key={testPlanVersion.id}>
<th>
<Link
to={`/candidate-test-plan/${testPlanVersion.id}/${atId}`}
>
{getTestPlanVersionTitle(testPlanVersion, {
includeVersionString: true
})}{' '}
({testsCount} Test
{testsCount === 0 || testsCount > 1 ? `s` : ''})
</Link>
</th>
<th>{getTitleEl()}</th>
<CenteredTd>
<i>
{dates.convertDateToString(
Expand Down Expand Up @@ -778,6 +798,7 @@ TestPlans.propTypes = {
)
})
).isRequired,
me: UserPropType.isRequired,
triggerPageUpdate: PropTypes.func
};

Expand Down
6 changes: 5 additions & 1 deletion client/components/CandidateReview/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import { useQuery } from '@apollo/client';
import PageStatus from '../common/PageStatus';
import TestPlans from './TestPlans';
import { CANDIDATE_REVIEW_PAGE_QUERY } from './queries';
import { ME_QUERY } from '../App/queries';

const CandidateReview = () => {
const { loading, data, error } = useQuery(CANDIDATE_REVIEW_PAGE_QUERY, {
fetchPolicy: 'cache-and-network'
});

const { data: meData } = useQuery(ME_QUERY);
const { me } = meData;

if (error) {
return (
<PageStatus
Expand All @@ -33,7 +37,7 @@ const CandidateReview = () => {

const testPlanVersions = data.testPlanVersions;

return <TestPlans testPlanVersions={testPlanVersions} />;
return <TestPlans testPlanVersions={testPlanVersions} me={me} />;
};

export default CandidateReview;
17 changes: 14 additions & 3 deletions client/components/ConfirmAuth/index.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React from 'react';
import { Navigate } from 'react-router-dom';
import { Navigate, useParams } from 'react-router-dom';
import PropTypes from 'prop-types';
import { useQuery } from '@apollo/client';
import { ME_QUERY } from '../App/queries';
import { evaluateAuth } from '../../utils/evaluateAuth';

const ConfirmAuth = ({ children, requiredPermission }) => {
const ConfirmAuth = ({ children, requiredPermission, requireVendorForAt }) => {
const { data } = useQuery(ME_QUERY);
const { atId } = useParams();

const auth = evaluateAuth(data && data.me ? data.me : {});
const { roles, username, isAdmin, isSignedIn } = auth;
const company = data && data.me ? data.me.company : null;

if (!username) return <Navigate to={{ pathname: '/invalid-request' }} />;

Expand All @@ -21,6 +23,14 @@ const ConfirmAuth = ({ children, requiredPermission }) => {
return <Navigate to="/404" replace />;
}

// Check if the user's company is the vendor for the associated At
if (requireVendorForAt && !isAdmin) {
const isVendorForAt = company && company.ats.some(at => at.id === atId);
if (!isVendorForAt) {
return <Navigate to="/404" replace />;
}
}

return children;
};

Expand All @@ -29,7 +39,8 @@ ConfirmAuth.propTypes = {
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]).isRequired,
requiredPermission: PropTypes.string
requiredPermission: PropTypes.string,
requireVendorForAt: PropTypes.bool
};

export default ConfirmAuth;
1 change: 0 additions & 1 deletion client/components/DisclaimerInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const DisclaimerInfo = ({ phase }) => {
<Container>
<details>
<summary
id="disclaimer-title"
aria-expanded={expanded}
aria-controls="description"
onClick={() => setExpanded(!expanded)}
Expand Down
3 changes: 3 additions & 0 deletions client/components/ManageBotRunDialog/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export const RETRY_CANCELED_COLLECTIONS = gql`
retryCanceledCollections {
id
status
testStatus {
status
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions client/components/common/fragments/Me.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ const ME_FIELDS = gql`
id
username
roles
company {
id
ats {
id
}
}
}
`;

Expand Down
15 changes: 14 additions & 1 deletion client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,20 @@ window.signMeInAsTester = username => {
};

window.signMeInAsVendor = username => {
return signMeInCommon({ username, roles: [{ name: 'VENDOR' }] });
return signMeInCommon({
username,
roles: [{ name: 'VENDOR' }],
company: {
id: '1',
name: 'vispero',
ats: [
{
id: '1',
name: 'JAWS'
}
]
}
});
};

window.startTestTransaction = async () => {
Expand Down
2 changes: 1 addition & 1 deletion client/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default () => (
exact
path="/candidate-test-plan/:testPlanVersionId/:atId"
element={
<ConfirmAuth requiredPermission="VENDOR">
<ConfirmAuth requiredPermission="VENDOR" requireVendorForAt={true}>
<CandidateTestPlanRun />
</ConfirmAuth>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export default testQueuePageQuery => [
__typename: 'User',
id: '1',
username: 'foo-bar',
roles: ['ADMIN', 'TESTER']
roles: ['ADMIN', 'TESTER'],
company: {
id: '1',
name: 'Company',
ats: []
}
},
users: [
{
Expand All @@ -18,23 +23,38 @@ export default testQueuePageQuery => [
username: 'foo-bar',
roles: ['ADMIN', 'TESTER'],
isBot: false,
ats: []
ats: [],
company: {
id: '1',
name: 'Company',
ats: []
}
},
{
__typename: 'User',
id: '4',
username: 'bar-foo',
roles: ['TESTER'],
isBot: false,
ats: []
ats: [],
company: {
id: '1',
name: 'Company',
ats: []
}
},
{
__typename: 'User',
id: '5',
username: 'boo-far',
roles: ['TESTER'],
isBot: false,
ats: []
ats: [],
company: {
id: '1',
name: 'Company',
ats: []
}
}
],
ats: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export default testQueuePageQuery => [
__typename: 'User',
id: '4',
username: 'bar-foo',
roles: ['TESTER']
roles: ['TESTER'],
company: {
id: '1',
name: 'Company',
ats: []
}
},
users: [
{
Expand All @@ -18,23 +23,38 @@ export default testQueuePageQuery => [
username: 'foo-bar',
roles: ['ADMIN', 'TESTER'],
isBot: false,
ats: []
ats: [],
company: {
id: '1',
name: 'Company',
ats: []
}
},
{
__typename: 'User',
id: '4',
username: 'bar-foo',
roles: ['TESTER'],
isBot: false,
ats: []
ats: [],
company: {
id: '1',
name: 'Company',
ats: []
}
},
{
__typename: 'User',
id: '5',
username: 'boo-far',
roles: ['TESTER'],
isBot: false,
ats: []
ats: [],
company: {
id: '1',
name: 'Company',
ats: []
}
}
],
ats: [],
Expand Down
Loading

0 comments on commit 1f87b26

Please sign in to comment.