feat: block filtering
This commit is contained in:
parent
b77a7a9599
commit
d8c0c2ce76
|
@ -4,6 +4,7 @@ import React, {useLayoutEffect, useRef} from 'react';
|
||||||
import {useSelector} from 'react-redux';
|
import {useSelector} from 'react-redux';
|
||||||
|
|
||||||
import {channelMessagesSelector} from '~/common/state/chat';
|
import {channelMessagesSelector} from '~/common/state/chat';
|
||||||
|
import {blockedSelector} from '~/common/state/user';
|
||||||
|
|
||||||
import useChannel from '~/client/hooks/useChannel';
|
import useChannel from '~/client/hooks/useChannel';
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ import ChatMessage from './chat--message';
|
||||||
import ChatSubmitMessage from './chat--submitMessage';
|
import ChatSubmitMessage from './chat--submitMessage';
|
||||||
|
|
||||||
export default function ChatMessages() {
|
export default function ChatMessages() {
|
||||||
|
const blocked = useSelector(blockedSelector);
|
||||||
const channel = useChannel();
|
const channel = useChannel();
|
||||||
const $messages = useRef(null);
|
const $messages = useRef(null);
|
||||||
const {current} = $messages;
|
const {current} = $messages;
|
||||||
|
@ -43,6 +45,9 @@ export default function ChatMessages() {
|
||||||
ref={$messages}
|
ref={$messages}
|
||||||
>
|
>
|
||||||
{messages && messages.map((message) => {
|
{messages && messages.map((message) => {
|
||||||
|
if (-1 !== blocked.indexOf(message.owner)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const $message = (
|
const $message = (
|
||||||
<ChatMessage
|
<ChatMessage
|
||||||
key={message.uuid}
|
key={message.uuid}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user