Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Feb 10, 2023
1 parent c9be240 commit 1854fd8
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const CaseViewActivity = ({
users={reporterAsArray}
userProfiles={userProfiles}
/>
{caseUsers?.participants ? (
{caseUsers != null ? (
<UserList
dataTestSubj="case-view-user-list-participants"
theCase={caseData}
Expand Down
26 changes: 26 additions & 0 deletions x-pack/test/cases_api_integration/common/lib/api/user_profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { UserProfileBulkGetParams, UserProfileServiceStart } from '@kbn/security
import { INTERNAL_SUGGEST_USER_PROFILES_URL } from '@kbn/cases-plugin/common/constants';
import { SuggestUserProfilesRequest } from '@kbn/cases-plugin/common/api';
import { UserProfileService } from '@kbn/cases-plugin/server/services';
import { UserProfileAvatarData } from '@kbn/security-plugin/common';
import { superUser } from '../authentication/users';
import { User } from '../authentication/types';
import { getSpaceUrlPrefix } from './helpers';
Expand Down Expand Up @@ -70,6 +71,31 @@ export const suggestUserProfiles = async ({
return profiles;
};

/**
* Updates the avatar of a user.
* The API needs a valid user session.
* The session acts as the user identifier
* whose the avatar is updated.
*/
export const updateUserProfileAvatar = async ({
supertest,
req,
expectedHttpCode = 200,
headers = {},
}: {
supertest: SuperTest.SuperTest<SuperTest.Test>;
req: UserProfileAvatarData;
expectedHttpCode?: number;
headers?: Record<string, unknown>;
}): Promise<void> => {
await supertest
.post('/internal/security/user_profile/_data')
.set('kbn-xsrf', 'true')
.set(headers)
.send({ avatar: req })
.expect(expectedHttpCode);
};

export const loginUsers = async ({
supertest,
users = [superUser],
Expand Down
Loading

0 comments on commit 1854fd8

Please sign in to comment.