From e332f4f4f254e82ee00ec96b85eac91ea8a25593 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 19 Jan 2024 10:53:11 -0800 Subject: [PATCH] compose: Don't convert bot mentions to silent mentions. This fixes an unintended consequence of the silent mention conversion logic added in 4d1ade1f886ef305ff898a3fed9e91a2605e88a8, where bots that looked for personal mentions would not process mentions in 1:1 DMs. (cherry picked from commit 60afdc45eb0f79754abd90be2f90987da84866ae) --- web/src/compose_validate.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/src/compose_validate.js b/web/src/compose_validate.js index c37afacd6f..9a1a955fdf 100644 --- a/web/src/compose_validate.js +++ b/web/src/compose_validate.js @@ -830,6 +830,13 @@ export function convert_mentions_to_silent_in_direct_messages(mention_text, full return mention_text; } + const user = people.get_user_by_id_assert_valid(user_id); + if (user.is_bot) { + // Since bots often process mentions as requests for them to + // do things, prefer non-silent mentions when DMing them. + return mention_text; + } + const mention_str = people.get_mention_syntax(full_name, user_id, false); const silent_mention_str = people.get_mention_syntax(full_name, user_id, true); mention_text = mention_text.replace(mention_str, silent_mention_str);