fix: suppress N/A source_tag in session list sidebar (#429)
- sessions.js _formatSourceTag(): return null for unrecognised tags instead of raw string — prevents legacy 'N/A' values from surfacing - sessions.js metaBits push: guarded with _stLabel null check so only known platform labels appear in the session metadata line - sessions.js [SYSTEM:] title fallback: drop raw s.source_tag middle term, fall back directly to 'Gateway' for unknown sources 7 new tests in test_issue429.py. 1 updated test in test_sprint40_ui_polish.py (new guarded push pattern). Closes #429
This commit is contained in:
@@ -182,9 +182,14 @@ class TestFormatSourceTagHelper(unittest.TestCase):
|
||||
"sessions.js should map slack -> 'via Slack'")
|
||||
|
||||
def test_metabits_uses_format_helper(self):
|
||||
"""The metaBits push for source_tag should use _formatSourceTag."""
|
||||
self.assertIn("metaBits.push(_formatSourceTag(s.source_tag))", SESSIONS_JS,
|
||||
"metaBits push should wrap source_tag with _formatSourceTag()")
|
||||
"""The metaBits push for source_tag should use _formatSourceTag with a null guard."""
|
||||
# Fix #429: the push now uses a temp variable guard to suppress null/N/A results:
|
||||
# const _stLabel=_formatSourceTag(s.source_tag); if(_stLabel) metaBits.push(_stLabel)
|
||||
# The old direct push pattern is gone; verify the guarded pattern is present.
|
||||
self.assertIn("_formatSourceTag(s.source_tag)", SESSIONS_JS,
|
||||
"metaBits push should still use _formatSourceTag() for source_tag display")
|
||||
self.assertIn("metaBits.push(_stLabel)", SESSIONS_JS,
|
||||
"metaBits push should use guarded _stLabel variable (fix #429)")
|
||||
|
||||
def test_raw_source_tag_not_pushed_directly(self):
|
||||
"""The old raw metaBits.push(s.source_tag) should not exist."""
|
||||
|
||||
Reference in New Issue
Block a user