Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session expiry #547

Merged
merged 3 commits into from
Sep 30, 2020
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
6 changes: 5 additions & 1 deletion src/components/UI/Timer/Timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styles from './Timer.module.css';
export interface TimerProps {
time: any;
contactStatus?: string;
contactProviderStatus?: string;
}

export const Timer: React.FC<TimerProps> = (props: TimerProps) => {
Expand Down Expand Up @@ -36,7 +37,10 @@ export const Timer: React.FC<TimerProps> = (props: TimerProps) => {
hours = '0' + hours.toString();
}

if (props.contactStatus && props.contactStatus === 'INVALID') {
if (
(props.contactStatus && props.contactStatus === 'INVALID') ||
props.contactProviderStatus === 'NONE'
) {
return <ContactOptOutIcon />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface ChatConversationProps {
contactId: number;
contactName: string;
contactStatus: string;
contactProviderStatus: string;
selected: boolean;
senderLastMessage: any;
onClick: (i: any) => void;
Expand Down Expand Up @@ -106,7 +107,11 @@ const ChatConversation: React.SFC<ChatConversationProps> = (props) => {
<div>
<div className={chatBubble.join(' ')} />
<div className={styles.Timer}>
<Timer time={props.senderLastMessage} contactStatus={props.contactStatus} />
<Timer
time={props.senderLastMessage}
contactStatus={props.contactStatus}
contactProviderStatus={props.contactProviderStatus}
/>
</div>
</div>
<div className={chatInfoClass.join(' ')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const ConversationList: React.SFC<ConversationListProps> = (props) => {
lastMessage={lastMessage}
senderLastMessage={conversation.contact.lastMessageAt}
contactStatus={conversation.contact.status}
contactProviderStatus={conversation.contact.providerStatus}
/>
);
});
Expand Down
5 changes: 4 additions & 1 deletion src/containers/Chat/ChatMessages/ChatInput/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export const ChatInput: React.SFC<ChatInputProps> = (props) => {
}
}

if (props.contactStatus && props.contactStatus === 'INVALID') {
if (
(props.contactStatus && props.contactStatus === 'INVALID') ||
props.contactProviderStatus === 'NONE'
) {
return (
<div className={styles.ContactOptOutMessage}>
Sorry, chat is unavailable with this contact at this moment because they aren’t opted in to
Expand Down
7 changes: 5 additions & 2 deletions src/containers/Chat/ChatMessages/ContactBar/ContactBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ export const ContactBar: React.SFC<ContactBarProps> = (props) => {
<div className={styles.Container}>
<div className={styles.SessionTimer} data-testid="sessionTimer">
<span>Session Timer</span>
<Timer time={props.lastMessageTime} contactStatus={props.contactStatus} />
<Timer
time={props.lastMessageTime}
contactStatus={props.contactStatus}
contactProviderStatus={props.contactProviderStatus}
/>
</div>
<div>
{assignedToGroup ? (
Expand All @@ -328,7 +332,6 @@ export const ContactBar: React.SFC<ContactBarProps> = (props) => {
<Typography className={styles.Title} variant="h6" noWrap data-testid="beneficiaryName">
{props.contactName}
</Typography>

<ClickAwayListener onClickAway={() => setAnchorEl(null)}>
<div className={styles.Configure}>
<DropdownIcon onClick={handleConfigureIconClick} />
Expand Down