N°7385 - Fix regression from b21a02dcb8 which made mentions on sub classes no longer working

This commit is contained in:
Molkobain
2026-08-15 12:26:07 +02:00
parent af08824866
commit 658825b308

View File

@@ -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;
}