@@ -29,7 +29,6 @@ import { BIG_BORDER_RADIUS, DEFAULT_BOT_USERNAME } from '@/constants';
2929import ChatbotAvatar from './ChatbotAvatar' ;
3030import CommentActions from './CommentActions' ;
3131import CommentBody from './CommentBody' ;
32- // import { useMembersContext } from '../context/MembersContext';
3332import CustomAvatar from './CustomAvatar' ;
3433
3534const CustomCard = styled ( Card ) < CardProps > ( {
@@ -43,46 +42,24 @@ type Props = {
4342
4443const Comment = ( { comment, onEdit } : Props ) : JSX . Element => {
4544 const { t, i18n } = useTranslation ( ) ;
46- // const members = useMembersContext();
47- // const {
48- // // [GENERAL_SETTINGS_NAME]: settings = DEFAULT_GENERAL_SETTINGS,
49- // } = useSettings();
50- const currentMemberId = useLocalContext ( ) . memberId ;
45+
46+ const { accountId } = useLocalContext ( ) ;
5147 const { data : appContext } = hooks . useAppContext ( ) ;
52- const currentMember = appContext ?. members . find (
53- ( m ) => m . id === currentMemberId ,
54- ) ;
48+ const currentMember = appContext ?. members . find ( ( m ) => m . id === accountId ) ;
5549 const { data : chatbotPrompts } = hooks . useAppSettings < ChatbotPromptSettings > ( {
5650 name : SettingsKeys . ChatbotPrompt ,
5751 } ) ;
5852 const chatbotPrompt = chatbotPrompts ?. [ 0 ] ;
59- // const { mutate: postAppData } = mutations.usePostAppData();
60-
61- // const allowCommentReporting = true; // settings[GeneralSettingsKeys.AllowCommentsReporting];
6253 const [ menuAnchorEl , setMenuAnchorEl ] = useState < null | HTMLElement > ( null ) ;
6354 const [ openActionsMenu , setOpenActionsMenu ] = useState ( false ) ;
64- // const [openFlagDialog, setOpenFlagDialog] = useState(false);
6555 const commentRef = useRef < HTMLDivElement > ( null ) ;
6656
67- // currently not using members
68- // const member = members.find((u) => u.id === comment.memberId);
69- // const userName = member?.name || ANONYMOUS_USER;
70-
7157 const isBot = comment . type === AppDataTypes . BotComment ;
7258
7359 const isEditable = ( ) : boolean =>
74- ! ! comment . creator &&
75- ! ! currentMemberId &&
76- comment . creator . id === currentMemberId ;
60+ ! ! comment . creator && ! ! accountId && comment . creator . id === accountId ;
7761 const isDeletable = ( ) : boolean => isEditable ( ) ;
7862
79- // const sendCommentReport = (reason: string): void => {
80- // postAppData({
81- // data: { reason, commentId: comment.id },
82- // type: AppDataTypes.FLAG,
83- // });
84- // };
85-
8663 return (
8764 < CustomCard
8865 data-cy = { buildCommentContainerDataCy ( comment . id ) }
@@ -92,8 +69,8 @@ const Comment = ({ comment, onEdit }: Props): JSX.Element => {
9269 < CardHeader
9370 title = {
9471 isBot
95- ? chatbotPrompt ?. data [ ChatbotPromptSettingsKeys . ChatbotName ] ||
96- DEFAULT_BOT_USERNAME
72+ ? ( chatbotPrompt ?. data [ ChatbotPromptSettingsKeys . ChatbotName ] ??
73+ DEFAULT_BOT_USERNAME )
9774 : currentMember ?. name
9875 }
9976 subheader = { formatDate ( comment . updatedAt , { locale : i18n . language } ) }
@@ -126,12 +103,6 @@ const Comment = ({ comment, onEdit }: Props): JSX.Element => {
126103 } }
127104 onEdit = { onEdit }
128105 />
129- { /* <ReportCommentDialog
130- open={openFlagDialog}
131- setOpen={setOpenFlagDialog}
132- // onSendReport={sendCommentReport}
133- commentRef={commentRef}
134- /> */ }
135106 </ >
136107 }
137108 />
0 commit comments