From b73687a9c54dcfc48c8336553ed7070c7a1242d0 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 13 Dec 2020 05:56:21 -0600 Subject: [PATCH] feat: MessageSiteBan --- .../react/components/chat/messages/message/index.jsx | 11 +++++++---- .../chat/messages/message/moderation/index.jsx | 12 +++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/react/components/chat/messages/message/index.jsx b/app/src/react/components/chat/messages/message/index.jsx index 0ba18b6..e5d2c11 100644 --- a/app/src/react/components/chat/messages/message/index.jsx +++ b/app/src/react/components/chat/messages/message/index.jsx @@ -23,6 +23,7 @@ export default function Message(props) { pending, rejected, timestamp, + uuid, }, } = props; const [undelivered, setUndelivered] = useState(false); @@ -56,10 +57,11 @@ export default function Message(props) { {isShort && $messageTime} @@ -74,5 +76,6 @@ Message.propTypes = { pending: PropTypes.bool, rejected: PropTypes.bool, timestamp: PropTypes.number, + uuid: PropTypes.string, }).isRequired, }; diff --git a/app/src/react/components/chat/messages/message/moderation/index.jsx b/app/src/react/components/chat/messages/message/moderation/index.jsx index f96d9d3..beed5d3 100644 --- a/app/src/react/components/chat/messages/message/moderation/index.jsx +++ b/app/src/react/components/chat/messages/message/moderation/index.jsx @@ -1,17 +1,20 @@ import './index.scss'; +import {useSocket} from '@latus/socket/client'; import PropTypes from 'prop-types'; import React from 'react'; import Actions from 'components/actions'; -export default function ChatMessageModeration(props) { +export default function Moderation(props) { const { messageIsAdmin, messageIsModerator, userIsAdmin, userIsModerator, + uuid, } = props; + const socket = useSocket(); const actions = []; if (messageIsAdmin) { actions.push(['👑', 'Admin distinction', () => {}]); @@ -20,7 +23,9 @@ export default function ChatMessageModeration(props) { actions.push(['🎩', 'Moderator distinction', () => {}]); } if (userIsAdmin) { - actions.push(['🛑', 'Site ban', () => {}]); + actions.push(['🛑', 'Site ban', () => { + socket.send(['MessageSiteBan', uuid]); + }]); } if (userIsModerator) { actions.push(['🚫', 'Channel ban', () => {}]); @@ -35,9 +40,10 @@ export default function ChatMessageModeration(props) { ); } -ChatMessageModeration.propTypes = { +Moderation.propTypes = { messageIsAdmin: PropTypes.bool.isRequired, messageIsModerator: PropTypes.bool.isRequired, userIsAdmin: PropTypes.bool.isRequired, userIsModerator: PropTypes.bool.isRequired, + uuid: PropTypes.string.isRequired, };