Merge pull request #12538 from ramonlsouza/emphasized-chat

feat: emphasize moderator messages in public chat
This commit is contained in:
Anton Georgiev 2021-06-08 09:39:19 -04:00 committed by GitHub
commit e4a6a74f76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -13,6 +13,8 @@ import { styles } from './styles';
const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_CLEAR_MESSAGE = CHAT_CONFIG.system_messages_keys.chat_clear;
const CHAT_POLL_RESULTS_MESSAGE = CHAT_CONFIG.system_messages_keys.chat_poll_result;
const CHAT_PUBLIC_ID = CHAT_CONFIG.public_id;
const CHAT_EMPHASIZE_TEXT = CHAT_CONFIG.moderatorChatEmphasized;
const propTypes = {
user: PropTypes.shape({
@ -128,6 +130,9 @@ class TimeWindowChatItem extends PureComponent {
const regEx = /<a[^>]+>/i;
ChatLogger.debug('TimeWindowChatItem::renderMessageItem', this.props);
const defaultAvatarString = name?.toLowerCase().slice(0, 2) || " ";
const emphasizedTextClass = isModerator && CHAT_EMPHASIZE_TEXT && chatId === CHAT_PUBLIC_ID ?
styles.emphasizedMessage : null;
return (
<div className={styles.item} key={`time-window-${messageKey}`}>
<div className={styles.wrapper}>
@ -160,7 +165,9 @@ class TimeWindowChatItem extends PureComponent {
<div className={styles.messages}>
{messages.map(message => (
<MessageChatItem
className={(regEx.test(message.text) ? styles.hyperlink : styles.message)}
className={regEx.test(message.text) ?
cx(styles.hyperlink, emphasizedTextClass) :
cx(styles.message, emphasizedTextClass)}
key={message.id}
text={message.text}
time={message.time}

View File

@ -171,3 +171,7 @@
padding-left: 1rem;
margin-top: var(--chat-poll-margin-sm) !important;
}
.emphasizedMessage{
font-weight: bold;
}

View File

@ -416,6 +416,7 @@ public:
chat_poll_result: PUBLIC_CHAT_POLL_RESULT
typingIndicator:
enabled: true
moderatorChatEmphasized: true
note:
enabled: true
url: ETHERPAD_HOST