Skip to content

Commit

Permalink
fix: updated review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
janrembold committed Jan 23, 2024
1 parent 8975ff0 commit c711aa1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
16 changes: 6 additions & 10 deletions src/components/groupChat/CreateChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,15 @@ export const CreateGroupChatView = (props) => {
arePrefilledValuesChanged
]);

const handleEditGroupChatBackButton = () => {
const handleBackButton = () => {
if (isEditGroupChatMode) {
const pathInfo =
(prevPathIsGroupChatInfo ? '/groupChatInfo' : '') +
getSessionListTab();
history.push(
`${listPath}/${activeSession.item.groupId}/${activeSession.item.id}${pathInfo}`
);
}
};

const handleCreateGroupChatBackButton = () => {
if (!isEditGroupChatMode) {
} else {
history.push('/sessions/consultant/sessionView');
}
};
Expand Down Expand Up @@ -552,7 +548,7 @@ export const CreateGroupChatView = (props) => {
<div className="createChat__header createChat__header--edit">
<div className="createChat__header__inner">
<span
onClick={handleEditGroupChatBackButton}
onClick={handleBackButton}
className="createChat__header__backButton"
>
<BackIcon />
Expand All @@ -569,7 +565,7 @@ export const CreateGroupChatView = (props) => {
<div className="createChat__header">
<div className="createChat__header__inner">
<span
onClick={handleEditGroupChatBackButton}
onClick={handleBackButton}
className="createChat__header__backButton"
>
<BackIcon />
Expand Down Expand Up @@ -672,7 +668,7 @@ export const CreateGroupChatView = (props) => {
<>
<Button
item={buttonSetCancel}
buttonHandle={handleEditGroupChatBackButton}
buttonHandle={handleBackButton}
/>
<Button
item={buttonSetSave}
Expand All @@ -684,7 +680,7 @@ export const CreateGroupChatView = (props) => {
<>
<Button
item={buttonSetCancel}
buttonHandle={handleCreateGroupChatBackButton}
buttonHandle={handleBackButton}
/>
<Button
item={buttonSetCreate}
Expand Down
11 changes: 6 additions & 5 deletions src/components/groupChat/GroupChatInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import * as React from 'react';
import { useEffect, useContext, useState, useCallback } from 'react';
import { Link, Redirect, useParams, useHistory } from 'react-router-dom';
import {
AUTHORITIES,
SessionTypeContext,
UserDataContext,
hasUserAuthority,
useTenant
} from '../../globalState';
import { isUserModerator, SESSION_LIST_TAB } from '../session/sessionHelpers';
Expand Down Expand Up @@ -189,10 +191,6 @@ export const GroupChatInfo = () => {
rcUserId: getValueFromCookie('rc_uid')
});

const isCurrentUserConsultant = userData?.userRoles?.includes(
'group-chat-consultant'
);

const preparedSettings: Array<{ label: string; value: string }> = [
{
label: translate('groupChat.info.settings.topic'),
Expand Down Expand Up @@ -235,7 +233,10 @@ export const GroupChatInfo = () => {
}
];

if (isCurrentUserConsultant && activeSession.item.hintMessage) {
if (
hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) &&
activeSession.item.hintMessage
) {
preparedSettings.push({
label: translate('groupChat.info.settings.hintMessage'),
value: activeSession.item.hintMessage
Expand Down

0 comments on commit c711aa1

Please sign in to comment.