mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-09 18:15:28 +00:00
Disable mention behavior on self-replies
This commit is contained in:
@@ -104,6 +104,25 @@ export default observer(({ channel, replies, setReplies }: Props) => {
|
|||||||
const ids = replies.map((x) => x.id);
|
const ids = replies.map((x) => x.id);
|
||||||
const messages = renderer.messages.filter((x) => ids.includes(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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{replies.map((reply, index) => {
|
{replies.map((reply, index) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user