Skip to content

Commit

Permalink
feat(peer-and-mainconsultant): rm peer and main consultant functional…
Browse files Browse the repository at this point in the history
…ities
  • Loading branch information
koepferd committed Jul 24, 2024
1 parent deb69fd commit 12312cd
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 96 deletions.
1 change: 0 additions & 1 deletion cypress/fixtures/registration/consultingType.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"slug": "suchtberatung",
"languageFormal": true,
"lockedAgencies": false,
"excludeNonMainConsultantsFromTeamSessions": false,
"whiteSpot": {
"whiteSpotAgencyAssigned": true,
"whiteSpotAgencyId": 100
Expand Down
1 change: 0 additions & 1 deletion cypress/fixtures/service.consultingtypes.addiction.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"slug": "suchtberatung",
"languageFormal": true,
"lockedAgencies": false,
"excludeNonMainConsultantsFromTeamSessions": false,
"whiteSpot": {
"whiteSpotAgencyAssigned": true,
"whiteSpotAgencyId": 100
Expand Down
1 change: 0 additions & 1 deletion cypress/fixtures/service.consultingtypes.emigration.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"slug": "rw-auswanderung",
"languageFormal": true,
"lockedAgencies": false,
"excludeNonMainConsultantsFromTeamSessions": false,
"whiteSpot": {
"whiteSpotAgencyAssigned": true,
"whiteSpotAgencyId": 1731
Expand Down
1 change: 0 additions & 1 deletion cypress/fixtures/service.consultingtypes.pregnancy.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"slug": "suchtberatung",
"languageFormal": true,
"lockedAgencies": false,
"excludeNonMainConsultantsFromTeamSessions": false,
"whiteSpot": {
"whiteSpotAgencyAssigned": true,
"whiteSpotAgencyId": 100
Expand Down
1 change: 0 additions & 1 deletion cypress/fixtures/service.consultingtypes.u25.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"slug": "u25",
"languageFormal": false,
"lockedAgencies": false,
"excludeNonMainConsultantsFromTeamSessions": false,
"whiteSpot": {
"whiteSpotAgencyAssigned": false
},
Expand Down
1 change: 0 additions & 1 deletion cypress/fixtures/service.users.sessions.room.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"postcode": "12345",
"language": "de",
"groupId": "someGroupId",
"isPeerChat": false,
"askerRcId": "askerRcId",
"e2eLastMessage": null,
"lastMessage": null,
Expand Down
2 changes: 0 additions & 2 deletions cypress/support/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const generateConsultantSession = ({
messageDate: 1606900238,
messagesRead: messagesRead === undefined ? true : messagesRead,
isTeamSession: true,
isPeerChat: false,
attachment: null,
registrationType: 'REGISTERED',
e2eLastMessage: {
Expand Down Expand Up @@ -114,7 +113,6 @@ export const generateAskerSession = ({
messageDate: null,
messagesRead: messagesRead === undefined ? true : messagesRead,
isTeamSession: isTeamSession === undefined ? true : isTeamSession,
isPeerChat: false,
attachment: null,
registrationType: 'REGISTERED',
e2eLastMessage: {
Expand Down
6 changes: 1 addition & 5 deletions src/components/askerInfo/AskerInfoContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const AskerInfoContent = () => {
const { type } = useContext(SessionTypeContext);

const isSessionAssignAvailable = useMemo(() => {
const isPeerChat = activeSession.item.isPeerChat;
const isLiveChat = activeSession.isLive;
const isGroupChat = activeSession.isGroup;
const isEnquiryListView = type === SESSION_LIST_TYPES.ENQUIRY;
Expand All @@ -36,7 +35,6 @@ export const AskerInfoContent = () => {

if (isEnquiryListView) {
return (
isPeerChat &&
hasUserAuthority(
AUTHORITIES.ASSIGN_CONSULTANT_TO_ENQUIRY,
userData
Expand All @@ -45,9 +43,7 @@ export const AskerInfoContent = () => {
}

return hasUserAuthority(
isPeerChat
? AUTHORITIES.ASSIGN_CONSULTANT_TO_PEER_SESSION
: AUTHORITIES.ASSIGN_CONSULTANT_TO_SESSION,
AUTHORITIES.ASSIGN_CONSULTANT_TO_SESSION,
userData
);
}, [activeSession, type, userData]);
Expand Down
20 changes: 1 addition & 19 deletions src/components/session/SessionItemComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ export const SessionItemComponent = (props: SessionItemProps) => {

useEffect(() => {
setCanWriteMessage(
type !== SESSION_LIST_TYPES.ENQUIRY ||
hasUserAuthority(AUTHORITIES.VIEW_ALL_PEER_SESSIONS, userData)
type !== SESSION_LIST_TYPES.ENQUIRY
);
}, [type, userData]);

Expand Down Expand Up @@ -191,16 +190,6 @@ export const SessionItemComponent = (props: SessionItemProps) => {
return translate('enquiry.write.input.placeholder.groupChat');
} else if (hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData)) {
return translate('enquiry.write.input.placeholder.asker');
} else if (
hasUserAuthority(AUTHORITIES.VIEW_ALL_PEER_SESSIONS, userData) &&
activeSession.isFeedback
) {
return translate('enquiry.write.input.placeholder.feedback.main');
} else if (
hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) &&
activeSession.isFeedback
) {
return translate('enquiry.write.input.placeholder.feedback.peer');
} else if (hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)) {
return translate('enquiry.write.input.placeholder.consultant');
}
Expand Down Expand Up @@ -443,13 +432,6 @@ export const SessionItemComponent = (props: SessionItemProps) => {

{type === SESSION_LIST_TYPES.ENQUIRY && (
<AcceptAssign
assignable={
!activeSession.isLive &&
hasUserAuthority(
AUTHORITIES.VIEW_ALL_PEER_SESSIONS,
userData
)
}
isAnonymous={false}
btnLabel={'enquiry.acceptButton.known'}
/>
Expand Down
8 changes: 1 addition & 7 deletions src/components/sessionsList/EmptyListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ export const EmptyListItem = ({ type, sessionListTab }: EmptyListItemProps) => {

switch (type) {
case SESSION_LIST_TYPES.TEAMSESSION:
const emptyKey = hasUserAuthority(
AUTHORITIES.VIEW_ALL_PEER_SESSIONS,
userData
)
? 'peerSessions'
: 'teamSessions';
return t(`sessionList.empty.${emptyKey}`);
return t(`sessionList.empty.teamSessions`);
case SESSION_LIST_TYPES.ENQUIRY:
return t('sessionList.empty.known');
case SESSION_LIST_TYPES.MY_SESSION:
Expand Down
20 changes: 4 additions & 16 deletions src/components/sessionsList/SessionsListWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,22 @@ export const SessionsListWrapper = ({
{type === SESSION_LIST_TYPES.MY_SESSION
? translate('sessionList.view.headline')
: null}
{type === SESSION_LIST_TYPES.TEAMSESSION &&
!hasUserAuthority(
AUTHORITIES.VIEW_ALL_PEER_SESSIONS,
userData
)
{type === SESSION_LIST_TYPES.TEAMSESSION
? translate('navigation.consultant.teamsessions.large')
: null}
{type === SESSION_LIST_TYPES.TEAMSESSION &&
hasUserAuthority(
AUTHORITIES.VIEW_ALL_PEER_SESSIONS,
userData
)
? translate('sessionList.peersessions.headline')
: null}
{type === SESSION_LIST_TYPES.ENQUIRY
? translate('sessionList.preview.headline')
: null}
</h2>
{type === SESSION_LIST_TYPES.MY_SESSION &&
hasUserAuthority(AUTHORITIES.CREATE_NEW_CHAT, userData) ? (
hasUserAuthority(AUTHORITIES.CREATE_NEW_CHAT, userData) ? (
<Link
className="sessionsList__createChatLink"
to={{
pathname: `/sessions/consultant/sessionView/createGroupChat${
sessionListTab
pathname: `/sessions/consultant/sessionView/createGroupChat${sessionListTab
? `?sessionListTab=${sessionListTab}`
: ''
}`
}`
}}
>
<span
Expand Down
27 changes: 7 additions & 20 deletions src/components/sessionsListItem/SessionListItemComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,26 +360,13 @@ export const SessionListItemComponent = ({
role="tab"
>
<div className="sessionsListItem__row">
{type === SESSION_LIST_TYPES.TEAMSESSION &&
hasUserAuthority(
AUTHORITIES.VIEW_ALL_PEER_SESSIONS,
userData
) &&
activeSession.consultant ? (
<div className="sessionsListItem__consultingType">
{translate('sessionList.user.peer')}:{' '}
{activeSession.consultant.firstName}{' '}
{activeSession.consultant.lastName}
</div>
) : (
<div className="sessionsListItem__consultingType">
{!isAsker &&
!activeSession.isLive &&
!autoSelectPostcode
? activeSession.item.postcode
: null}
</div>
)}
<div className="sessionsListItem__consultingType">
{!isAsker &&
!activeSession.isLive &&
!autoSelectPostcode
? activeSession.item.postcode
: null}
</div>
{topic?.name && (
<div
className="sessionsListItem__topic"
Expand Down
2 changes: 0 additions & 2 deletions src/globalState/helpers/stateHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ export const hasUserAuthority = (
export const AUTHORITIES = {
ANONYMOUS_DEFAULT: 'AUTHORIZATION_ANONYMOUS_DEFAULT',
ASSIGN_CONSULTANT_TO_ENQUIRY: 'AUTHORIZATION_ASSIGN_CONSULTANT_TO_ENQUIRY',
ASSIGN_CONSULTANT_TO_PEER_SESSION:
'AUTHORIZATION_ASSIGN_CONSULTANT_TO_PEER_SESSION',
ASSIGN_CONSULTANT_TO_SESSION: 'AUTHORIZATION_ASSIGN_CONSULTANT_TO_SESSION',
CONSULTANT_DEFAULT: 'AUTHORIZATION_CONSULTANT_DEFAULT',
CREATE_NEW_CHAT: 'AUTHORIZATION_CREATE_NEW_CHAT',
Expand Down
1 change: 0 additions & 1 deletion src/globalState/interfaces/SessionsDataInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export interface SessionItemInterface {
| statusActive
| statusFinished
| statusArchived;
isPeerChat: boolean;
isTeamSession: boolean;
videoCallMessageDTO: VideoCallMessageDTO;
language?: string;
Expand Down
9 changes: 0 additions & 9 deletions src/resources/i18n/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,6 @@
},
"consultant": {
"enquiries": "Erstanfragen",
"peersessions": {
"large": "Peer Beratungen",
"small": "Peer Ber."
},
"sessions": {
"large": "Meine Beratungen",
"small": "Nachrichten"
Expand Down Expand Up @@ -2195,9 +2191,7 @@
"archived": "Es sind noch keine Beratungen archiviert",
"known": "Aktuell liegen keine Erstanfragen vor",
"mySessions": "Sie haben zurzeit keine aktiven Beratungen",
"peerSessions": "Sie haben zurzeit keine aktiven Peer-Beratungen",
"teamSessions": "Ihr Team hat keine aktiven Beratungen",
"peersessions": "Sie haben zur Zeit keine aktiven Peer-Beratungen"
},
"filter": {
"option": {
Expand All @@ -2207,9 +2201,6 @@
},
"placeholder": "Filter"
},
"peersessions": {
"headline": "Peer-Beratungen"
},
"preview": {
"anonymous": {
"tab": "Live-Chat Anfragen"
Expand Down
1 change: 0 additions & 1 deletion src/resources/i18n/de@informal/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@
"sessionList": {
"empty": {
"mySessions": "Du hast zurzeit keine aktiven Beratungen",
"peerSessions": "Du hast zurzeit keine aktiven Peer-Beratungen",
"teamSessions": "Dein Team hat keine aktiven Beratungen"
},
"unavailable": {
Expand Down
8 changes: 0 additions & 8 deletions src/resources/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1279,10 +1279,6 @@
},
"consultant": {
"enquiries": "Initial inquiries",
"peersessions": {
"large": "Peer consultations",
"small": "Peer Con."
},
"sessions": {
"large": "My consultations",
"small": "Messages"
Expand Down Expand Up @@ -2076,7 +2072,6 @@
"archived": "There are no consultations in the archive yet",
"known": "There are no requests at the moment",
"mySessions": "You currently have no active consultations",
"peersessions": "You currently have no active peer counselling",
"teamSessions": "Your team has no active consultations"
},
"filter": {
Expand All @@ -2087,9 +2082,6 @@
},
"placeholder": "Filter"
},
"peersessions": {
"headline": "Peer consultations"
},
"preview": {
"anonymous": {
"tab": "Live chat requests"
Expand Down

0 comments on commit 12312cd

Please sign in to comment.