fix(gateway): keep no-patterns early return in mention compilation
The compile_mention_patterns promotion moved the 'patterns is None -> return []' short-circuit into the shared helper, which meant the telegram/dingtalk wrappers now evaluated self.name (via log_prefix=) even on the no-patterns path. On main that path returned before touching any adapter attributes; tests construct bare adapters via object.__new__ that lack .platform, so TestTelegramGuestMentionGating failed with AttributeError. Restore the early return in both wrappers for exact behavior parity with main.
This commit is contained in:
parent
1f45ff9e8a
commit
703fe94174
|
|
@ -458,6 +458,12 @@ class DingTalkAdapter(BasePlatformAdapter):
|
|||
loaded = [part.strip() for part in raw.split(",") if part.strip()]
|
||||
patterns = loaded
|
||||
|
||||
if patterns is None:
|
||||
# Parity with the historical inline implementation: return before
|
||||
# evaluating ``self.name`` (avoids touching adapter attributes on
|
||||
# the no-patterns path).
|
||||
return []
|
||||
|
||||
return compile_mention_patterns(
|
||||
patterns,
|
||||
log_prefix=self.name,
|
||||
|
|
|
|||
|
|
@ -7818,6 +7818,12 @@ class TelegramAdapter(BasePlatformAdapter):
|
|||
loaded = [part.strip() for part in raw.split(",") if part.strip()]
|
||||
patterns = loaded
|
||||
|
||||
if patterns is None:
|
||||
# Parity with the historical inline implementation: return before
|
||||
# evaluating ``self.name`` (tests construct bare adapters via
|
||||
# object.__new__ that lack the attributes ``name`` reads).
|
||||
return []
|
||||
|
||||
return compile_mention_patterns(
|
||||
patterns,
|
||||
log_prefix=self.name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue