mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
Disable mention behavior on self-replies
This commit is contained in:
parent
b01a3c5554
commit
29ed48fa70
1 changed files with 19 additions and 0 deletions
|
@ -104,6 +104,25 @@ export default observer(({ channel, replies, setReplies }: Props) => {
|
|||
const ids = replies.map((x) => x.id);
|
||||
const messages = renderer.messages.filter((x) => ids.includes(x._id));
|
||||
|
||||
useEffect(() => {
|
||||
let mentionsChanged = false;
|
||||
const modified = replies.map((reply) => {
|
||||
const message = messages.find((x) => reply.id === x._id);
|
||||
if (message?.author_id === client.user!._id && reply.mention) {
|
||||
mentionsChanged = true;
|
||||
return {
|
||||
...reply,
|
||||
mention: false,
|
||||
};
|
||||
}
|
||||
|
||||
return reply;
|
||||
});
|
||||
if (mentionsChanged) {
|
||||
setReplies(modified);
|
||||
}
|
||||
}, [replies, setReplies, client.user, messages]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{replies.map((reply, index) => {
|
||||
|
|
Loading…
Reference in a new issue