Skip to content

Commit

Permalink
refactor: change condition to use the logical AND operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dun-sin committed Nov 23, 2024
1 parent a4658fb commit 56f32d4
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions client/src/components/Chat/MessageList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BsArrow90DegLeft, BsArrow90DegRight } from 'react-icons/bs';

import React, { useState } from 'react';

import BadWordsNext from 'bad-words-next';
Expand All @@ -10,7 +9,6 @@ import MessageSeen from './MessageSeen';
import PropTypes from 'prop-types';
import Status from './Status';
import chatHelper from 'src/lib/chatHelper';

import en from 'bad-words-next/data/en.json';
import { useApp } from 'src/context/AppContext';
import { useChat } from 'src/context/ChatContext';
Expand Down Expand Up @@ -156,19 +154,13 @@ const MessageList = ({
__html: md.render(
badwordChoices[id] === 'hide'
? badwords.filter(message)
: badwordChoices[id] === 'show'
? message
: message
: badwordChoices[id] === 'show' && message
),
}}
/>
) : badwordChoices[id] === 'hide' ? (
badwords.filter(message)
) : badwordChoices[id] === 'show' ? (
message
) : (
message
)}
) : badwordChoices[id] === 'show' && message}

<DropDownOptions
isSender={isSender && status !== 'pending'}
Expand Down

0 comments on commit 56f32d4

Please sign in to comment.