Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public enum Permission {
CAN_ADMINISTER_FEEDBACK_ANSWER("Administer feedback answers", "Feedback"),
CAN_ADMINISTER_FEEDBACK_TEMPLATES("Administer feedback templates", "Feedback"),
CAN_SEND_EMAIL("Send email", "Feedback"),
CAN_VIEW_TERMINATED_MEMBERS("Can view the profiles of terminated members", "User Management"),
CAN_EDIT_ALL_ORGANIZATION_MEMBERS("Edit all member profiles", "User Management"),
CAN_DELETE_ORGANIZATION_MEMBERS("Delete organization members", "User Management"),
CAN_CREATE_ORGANIZATION_MEMBERS("Create organization members", "User Management"),
Expand Down
7 changes: 5 additions & 2 deletions web-ui/src/components/kudos/PublicKudosCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import {
TextField,
Link,
} from "@mui/material";
import { selectCsrfToken, selectProfile } from "../../context/selectors";
import {
selectCsrfToken,
selectActiveOrInactiveProfile,
} from "../../context/selectors";
import { AppContext } from "../../context/AppContext";
import { getAvatarURL } from "../../api/api";
import DateFnsUtils from "@date-io/date-fns";
Expand Down Expand Up @@ -50,7 +53,7 @@ const KudosCard = ({ kudos }) => {
const { state, dispatch } = useContext(AppContext);
const csrf = selectCsrfToken(state);

const sender = selectProfile(state, kudos.senderId);
const sender = selectActiveOrInactiveProfile(state, kudos.senderId);

const regexIndexOf = (text, regex, start) => {
const indexInSuffix = text.slice(start).search(regex);
Expand Down
7 changes: 5 additions & 2 deletions web-ui/src/components/kudos_card/KudosCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import {
FormControlLabel,
Checkbox,
} from "@mui/material";
import { selectCsrfToken, selectProfile } from "../../context/selectors";
import {
selectCsrfToken,
selectActiveOrInactiveProfile,
} from "../../context/selectors";
import MemberSelector from '../member_selector/MemberSelector';
import { AppContext } from "../../context/AppContext";
import { getAvatarURL } from "../../api/api";
Expand Down Expand Up @@ -63,7 +66,7 @@ const KudosCard = ({ kudos, includeActions, includeEdit, onKudosAction }) => {
const [memberSelectorOpen, setMemberSelectorOpen] = useState(false);
const [kudosRecipientMembers, setKudosRecipientMembers] = useState(kudos.recipientMembers);

const sender = selectProfile(state, kudos.senderId);
const sender = selectActiveOrInactiveProfile(state, kudos.senderId);

const getRecipientComponent = useCallback(() => {
if (kudos.recipientTeam) {
Expand Down
157 changes: 157 additions & 0 deletions web-ui/src/components/kudos_card/KudosCard.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import React from 'react';
import KudosCard from './KudosCard';
import { AppContextProvider } from '../../context/AppContext';

const initialState = {
state: {
csrf: 'O_3eLX2-e05qpS_yOeg1ZVAs9nDhspEi',
teams: [],
userProfile: {
id: "1",
firstName: 'Jimmy',
lastName: 'Johnson',
role: ['MEMBER'],
},
terminatedMembers: [
{
id: "5",
firstName: 'Jerry',
lastName: 'Garcia',
name: 'Jerry Garcia',
role: ['MEMBER'],
},
],
memberProfiles: [
{
id: "1",
firstName: 'Jimmy',
lastName: 'Johnson',
name: 'Jimmy Johnson',
role: ['MEMBER'],
},
{
id: "2",
firstName: 'Jimmy',
lastName: 'Olsen',
name: 'Jimmy Olsen',
role: ['MEMBER'],
},
{
id: "3",
firstName: 'Clark',
lastName: 'Kent',
name: 'Clark Kent',
role: ['MEMBER'],
},
{
id: "4",
firstName: 'Kent',
lastName: 'Brockman',
name: 'Kent Brockman',
role: ['MEMBER'],
},
{
id: "6",
firstName: 'Brock',
lastName: 'Smith',
name: 'Brock Smith',
role: ['MEMBER'],
},
{
id: "7",
firstName: 'Jimmy',
middleName: 'T.',
lastName: 'Olsen',
name: 'Jimmy T. Olsen',
role: ['MEMBER'],
},
],
}
};

const terminated = {
id: 'test-terminated-kudos',
message: "Brock and Brockman did a great job helping Clark, Jimmy Olsen, Jimmy T. Olsen, and Johnson",
senderId: "5",
dateCreated: [ 2025, 2, 14 ],
recipientMembers: [
{
id: "1",
firstName: 'Jimmy',
lastName: 'Johnson',
role: ['MEMBER'],
},
{
id: "2",
firstName: 'Jimmy',
lastName: 'Olsen',
role: ['MEMBER'],
},
{
id: "3",
firstName: 'Clark',
lastName: 'Kent',
role: ['MEMBER'],
},
{
id: "6",
firstName: 'Brock',
lastName: 'Smith',
role: ['MEMBER'],
},
{
id: "4",
firstName: 'Kent',
lastName: 'Brockman',
role: ['MEMBER'],
},
{
id: "7",
firstName: 'Jimmy',
middleName: 'T.',
lastName: 'Olsen',
role: ['MEMBER'],
},
],
};

const kudos = {
id: 'test-kudos',
message: "Jimmy is awesome!",
senderId: "1",
dateCreated: [ 2025, 2, 17 ],
recipientMembers: [
{
id: "2",
firstName: 'Jimmy',
lastName: 'Olsen',
role: ['MEMBER'],
},
],
};

it('inactive renders correctly', () => {
snapshot(
<AppContextProvider value={initialState}>
<KudosCard
kudos={terminated}
includeActions
includeEdit
onKudosAction={() =>{}}
/>
</AppContextProvider>
);
});

it('active renders correctly', () => {
snapshot(
<AppContextProvider value={initialState}>
<KudosCard
kudos={kudos}
includeActions
includeEdit
onKudosAction={() =>{}}
/>
</AppContextProvider>
);
});
Loading
Loading