From 658825b308ecc4e73d69c4b8d1eba9d84b5230d2 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Sat, 15 Aug 2026 12:26:07 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07385=20-=20Fix=20regression=20from=20b21?= =?UTF-8?q?a02dcb8=20which=20made=20mentions=20on=20sub=20classes=20no=20l?= =?UTF-8?q?onger=20working?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/utils.inc.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/application/utils.inc.php b/application/utils.inc.php index d31499ba8..f8fe7a184 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -3047,12 +3047,25 @@ TXT $sMatchedId = $aMentionMatches[3][$iMatchIdx]; $sMatchedName = $aMentionMatches[5][$iMatchIdx]; + // Ensure that what we found is actually configured as a mention $sMentionPrefix = array_search($sMatchedClass, $aMentionAllowedClasses); - if ($sMentionPrefix === false) { - continue; + // - No direct configuration for the matched class, let's look for a configuration on parent classes + if (false === $sMentionPrefix) { + $bHasMentionConfigurationForParentClass = false; + foreach (MetaModel::EnumParentClasses($sMatchedClass, ENUM_PARENT_CLASSES_EXCLUDELEAF, false) as $aMatchedParentClass) { + $sMentionPrefix = array_search($aMatchedParentClass, $aMentionAllowedClasses); + if (false !== $sMentionPrefix) { + $bHasMentionConfigurationForParentClass = true; + break; + } + } + + if (false === $bHasMentionConfigurationForParentClass) { + continue; + } } - // Test if the name starts with $sMentionPrefix (e.g. '@' for 'Contact' class) - if (str_starts_with($sMatchedName, $sMentionPrefix) === false) { + // - Test if the name starts with $sMentionPrefix (e.g. '@' for 'Contact' class) + if (false === str_starts_with($sMatchedName, $sMentionPrefix)) { continue; }