Skip to content

Commit

Permalink
Fixed integration user errors (#2679)
Browse files Browse the repository at this point in the history
* Fixed integration user errors

* Fixed GitHub build errors
  • Loading branch information
jsorohova authored Sep 24, 2024
1 parent cca58a4 commit 5580269
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mainCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
input-urls: http://localhost:12345/profile http://localhost:12345/500 http://localhost:12345/404

- name: Upload report artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: accessibility-reports
path: ${{ github.workspace }}/_accessibility-reports
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Run tests
run: npx playwright test tests/ --workers 1

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
Expand Down
2 changes: 1 addition & 1 deletion src/components/users/profile/ko/runtime/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Profile {
await this.usersService.ensureSignedIn();

const model: User = await this.usersService.getCurrentUser();
this.isBasicAccount(model.isBasicAccount);
this.isBasicAccount(model?.isBasicAccount);
this.setUser(model);
}

Expand Down
7 changes: 6 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,9 @@ export const overrideToastSessionKeyPrefix = "MS_APIM_CW_override_toast_dismisse
* Styling constants
*/
export const mobileBreakpoint = 768;
export const smallMobileBreakpoint = 400;
export const smallMobileBreakpoint = 400;

/**
* Key of the default admin user
*/
export const integrationUserId = '/users/integration';
2 changes: 1 addition & 1 deletion src/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class User {
this.note = contract.properties.note;
this.groups = contract.properties.groups;
this.identities = contract.properties.identities;
this.isBasicAccount = this.identities[0]?.provider === "Basic";
this.isBasicAccount = this.identities?.[0]?.provider === "Basic";
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/services/productService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ export class ProductService {
if (!userId) {
throw new Error(`Parameter "userId" not specified.`);
}

if (userId === Constants.integrationUserId) {
return new Page();
}

const skip = searchRequest && searchRequest.skip || 0;
const take = searchRequest && searchRequest.take || Constants.defaultPageSize;
Expand Down
2 changes: 1 addition & 1 deletion src/services/usersService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class UsersService {
try {
const userId = await this.getCurrentUserId();

if (!userId) {
if (!userId || userId === Constants.integrationUserId) {
return null;
}

Expand Down

0 comments on commit 5580269

Please sign in to comment.