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

refactor: change condition to use the logical AND operator #726

Merged
merged 1 commit into from
Nov 23, 2024
Merged
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
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
Loading