Skip to content

Commit

Permalink
Merge pull request #68 from CaritasDeutschland/bugfix-release-2020-11-25
Browse files Browse the repository at this point in the history
Hotfixes from release 2020-11-25 to CRA
  • Loading branch information
koepferd authored Nov 30, 2020
2 parents 64c4213 + 93576cc commit 91b7c63
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 75 deletions.
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 10 additions & 15 deletions src/components/app/RouterConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ export const RouterConfigConsultant = (): any => {
path: '/sessions/consultant/sessionView/createGroupChat/',
component: CreateGroupChatView
},
{
path:
'/sessions/consultant/sessionView/:rcGroupId/:sessionId/groupChatInfo',
component: GroupChatInfo
},
{
path:
'/sessions/consultant/sessionView/:rcGroupId/:sessionId/editGroupChat',
Expand All @@ -147,6 +142,11 @@ export const RouterConfigConsultant = (): any => {
path:
'/sessions/consultant/sessionView/:rcGroupId/:sessionId/userProfile/monitoring',
component: Monitoring
},
{
path:
'/sessions/consultant/sessionView/:rcGroupId/:sessionId/groupChatInfo',
component: GroupChatInfo
}
],
profileRoutes: [
Expand Down Expand Up @@ -229,11 +229,6 @@ export const RouterConfigTeamConsultant = (): any => {
component: SessionView,
type: SESSION_TYPES.MY_SESSION
},
{
path:
'/sessions/consultant/sessionView/:rcGroupId/:sessionId/groupChatInfo',
component: GroupChatInfo
},
{
path:
'/sessions/consultant/sessionView/:rcGroupId/:sessionId/editGroupChat',
Expand All @@ -249,11 +244,6 @@ export const RouterConfigTeamConsultant = (): any => {
component: SessionView,
type: SESSION_TYPES.TEAMSESSION
},
{
path:
'/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/groupChatInfo',
component: GroupChatInfo
},
{
path:
'/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/editGroupChat',
Expand Down Expand Up @@ -290,6 +280,11 @@ export const RouterConfigTeamConsultant = (): any => {
path:
'/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/userProfile/monitoring',
component: Monitoring
},
{
path:
'/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/groupChatInfo',
component: GroupChatInfo
}
],
profileRoutes: [
Expand Down
1 change: 0 additions & 1 deletion src/components/app/navigationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const initNavigationHandler = () => {
};

const activateNavigationItem = (e: Event, navItems) => {
setProfileWrapperInactive();
mobileListView();
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/enquiry/WriteEnquiry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const overlayItem: OverlayItem = {
]
};

export const WriteEnquiry = (props) => {
export const WriteEnquiry = () => {
const { sessionsData } = useContext(SessionsDataContext);
const { setAcceptedGroupId } = useContext(AcceptedGroupIdContext);
const { activeSessionGroupId } = useContext(ActiveSessionGroupIdContext);
Expand Down
44 changes: 23 additions & 21 deletions src/components/groupChat/JoinGroupChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
getSessionsDataWithChangedValue,
StoppedGroupChatContext,
hasUserAuthority,
AUTHORITIES
AUTHORITIES,
AcceptedGroupIdContext
} from '../../globalState';
import { mobileDetailView, mobileListView } from '../app/navigationHandler';
import { SessionHeaderComponent } from '../sessionHeader/SessionHeaderComponent';
Expand Down Expand Up @@ -54,7 +55,7 @@ export const JoinGroupChatView = () => {
history.push(getSessionListPathForLocation());
}
const chatItem = getChatItemForSession(activeSession);

const { setAcceptedGroupId } = useContext(AcceptedGroupIdContext);
const [overlayItem, setOverlayItem] = useState<OverlayItem>(null);
const [overlayActive, setOverlayActive] = useState(false);
const [redirectToSessionsList, setRedirectToSessionsList] = useState(false);
Expand Down Expand Up @@ -89,7 +90,7 @@ export const JoinGroupChatView = () => {
return function stopTimeout() {
window.clearTimeout(timeoutId);
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
}, [activeSession]); // eslint-disable-line react-hooks/exhaustive-deps

const updateGroupChatInfo = () => {
if (chatItem.groupId === activeSessionGroupId) {
Expand Down Expand Up @@ -135,24 +136,25 @@ export const JoinGroupChatView = () => {
: GROUP_CHAT_API.JOIN;
ajaxCallPutGroupChat(chatItem.id, groupChatApiCall)
.then(() => {
let changedSessionsData = getSessionsDataWithChangedValue(
sessionsData,
activeSession,
'active',
true
);
changedSessionsData = getSessionsDataWithChangedValue(
changedSessionsData,
activeSession,
'subscribed',
true
);
setSessionsData(changedSessionsData);
history.push(
`${getSessionListPathForLocation()}/${chatItem.groupId}/${
chatItem.id
}`
);
if (
hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)
) {
let changedSessionsData = getSessionsDataWithChangedValue(
sessionsData,
activeSession,
'active',
true
);
changedSessionsData = getSessionsDataWithChangedValue(
changedSessionsData,
activeSession,
'subscribed',
true
);
setSessionsData(changedSessionsData);
}
setAcceptedGroupId(chatItem.groupId);
history.push(getSessionListPathForLocation());
})
.catch(() => {
setOverlayItem(startJoinGroupChatErrorOverlay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ export const MessageSubmitInterfaceComponent = (

useEffect(() => {
resizeTextarea();
if (!attachmentSelected && uploadProgress) {
removeSelectedAttachment();
}
}, [attachmentSelected]); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
Expand All @@ -263,7 +260,6 @@ export const MessageSubmitInterfaceComponent = (

useEffect(() => {
if (uploadOnLoadHandling) {
removeSelectedAttachment();
if (uploadOnLoadHandling.status === 201) {
handleMessageSendSuccess();
cleanupAttachment();
Expand Down Expand Up @@ -294,7 +290,9 @@ export const MessageSubmitInterfaceComponent = (
}
}
setEditorState(currentEditorState);
currentDraftMessageRef.current = getTypedMarkdownMessage();
currentDraftMessageRef.current = getTypedMarkdownMessage(
currentEditorState
);
};

const handleEditorKeyCommand = (command) => {
Expand Down Expand Up @@ -405,8 +403,10 @@ export const MessageSubmitInterfaceComponent = (
editorRef.focus();
};

const getTypedMarkdownMessage = () => {
const contentState = editorState.getCurrentContent();
const getTypedMarkdownMessage = (currentEditorState?: EditorState) => {
const contentState = currentEditorState
? currentEditorState.getCurrentContent()
: editorState.getCurrentContent();
const rawObject = convertToRaw(contentState);
const markdownString = draftToMarkdown(rawObject);
return markdownString.trim();
Expand Down Expand Up @@ -504,8 +504,8 @@ export const MessageSubmitInterfaceComponent = (
}, 700);
}
setEditorState(EditorState.createEmpty());
setActiveInfo('');
currentDraftMessageRef.current = '';
setActiveInfo('');
resizeTextarea();
setTimeout(() => setIsRequestInProgress(false), 1200);
};
Expand Down
4 changes: 4 additions & 0 deletions src/components/profile/ProfileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ import {
AUTHORITIES
} from '../../globalState';
import { ProfileDataViewAsker } from './ProfileDataViewAsker';
import { setProfileWrapperInactive } from '../app/navigationHandler';
import './profile.styles';

export const ProfileView = () => {
const { userData } = useContext(UserDataContext);

useEffect(() => {
setProfileWrapperActive();
return () => {
setProfileWrapperInactive();
};
}, []);

const handleLogout = () => {
Expand Down
7 changes: 5 additions & 2 deletions src/components/sessionAssign/SessionAssign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '../overlay/Overlay';
import { BUTTON_TYPES } from '../button/Button';
import { translate } from '../../resources/scripts/i18n/translate';
import { history } from '../app/app';
import {
getUserData,
getAgencyConsultantList,
Expand All @@ -28,7 +29,9 @@ import {
SelectOption
} from '../select/SelectDropdown';
import { FETCH_ERRORS } from '../apiWrapper/fetchData';
import { getSessionListPathForLocation } from '../session/sessionHelpers';

export const ACCEPTED_GROUP_CLOSE = 'CLOSE';
export interface Consultant {
consultantId: string;
firstName: string;
Expand Down Expand Up @@ -145,10 +148,10 @@ export const SessionAssign = (props: { value?: string }) => {

const handleOverlayAction = (buttonFunction: string) => {
setOverlayActive(false);

if (buttonFunction === OVERLAY_FUNCTIONS.CLOSE) {
setActiveSessionGroupId(null);
setAcceptedGroupId('CLOSE');
setAcceptedGroupId(ACCEPTED_GROUP_CLOSE);
history.push(getSessionListPathForLocation());
} else {
setAcceptedGroupId(activeSession.session.groupId);
}
Expand Down
22 changes: 2 additions & 20 deletions src/components/sessionHeader/SessionHeaderComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,11 @@ import { decodeUsername } from '../../resources/scripts/helpers/encryptionHelper
import './sessionHeader.styles';
import './sessionHeader.yellowTheme.styles';

export interface SessionHeader {
username: string;
postcode: string;
gender?: number;
age?: number;
addictiveDrugs?: number;
relation?: number;
agency?: {
id: number;
name: string;
postcode: string;
description: string;
teamAgency: boolean;
};
export interface SessionHeaderProps {
consultantAbsent?: boolean;
inTeamSession: boolean;
}

export const SessionHeaderComponent = (props) => {
export const SessionHeaderComponent = (props: SessionHeaderProps) => {
const { userData } = useContext(UserDataContext);
const { sessionsData } = useContext(SessionsDataContext);
const { activeSessionGroupId, setActiveSessionGroupId } = useContext(
Expand All @@ -82,10 +68,6 @@ export const SessionHeaderComponent = (props) => {
const [isSubscriberFlyoutOpen, setIsSubscriberFlyoutOpen] = useState(false);
const [subscriberList, setSubscriberList] = useState([]);

useEffect(() => {
activeSession = getActiveSession(activeSessionGroupId, sessionsData); // eslint-disable-line
});

useEffect(() => {
if (isSubscriberFlyoutOpen) {
document.addEventListener('mousedown', (event) =>
Expand Down
Loading

0 comments on commit 91b7c63

Please sign in to comment.