Skip to content

INF-431: fallback when full name is empty - #4368

Open
bartlomiejmarszal wants to merge 1 commit into
developfrom
fix/INF-431/empty-fullname-fallback
Open

INF-431: fallback when full name is empty#4368
bartlomiejmarszal wants to merge 1 commit into
developfrom
fix/INF-431/empty-fullname-fallback

Conversation

@bartlomiejmarszal

@bartlomiejmarszal bartlomiejmarszal commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a fallback label when the full name/label is empty in the header menu

Testing

2026-02-02.16-28-19.mov

Ticket

  • INF-431

Related

https://github.com/oat-sa/extension-lti-test-review/pull/161/changes

Summary by CodeRabbit

  • Bug Fixes
    • The header user label now displays a default name when unavailable, ensuring consistent user identification display in the navigation.

@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Modified header navigation template to display a fallback "User" label when the custom user name field is empty in LTI 1.3 contexts. Replaced conditional elseif branch with else clause and introduced displayName variable for consistent fallback behavior.

Changes

Cohort / File(s) Summary
User Label Fallback
views/templates/blocks/header-main-navi.tpl
Changed user label rendering to always display content in the user label area, using a computed displayName variable that defaults to "User" when userLabel is empty. Replaced elseif conditional with else branch.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

⏱️ <10 Min Review

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: adding a fallback when the full name/user label is empty, which matches the code modifications in the header navigation template.
Linked Issues check ✅ Passed The code changes implement the required fallback label functionality by introducing a $displayName variable that defaults to __('User') when $userLabel is empty, directly addressing INF-431.
Out of Scope Changes check ✅ Passed All changes are scoped to the header navigation template and implement only the fallback label functionality required by INF-431; no extraneous modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/INF-431/empty-fullname-fallback

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown

Version

Target Version 55.2.2
Last version 55.2.1

There are 0 BREAKING CHANGE, 0 feature, 1 fix

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown

Front-end summary Node 18

💯 Total ✅ Passed ⏭️ Skipped ❌ Failed
244 244 0 0

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@views/templates/blocks/header-main-navi.tpl`:
- Around line 107-113: Add isolated unit tests under tests/ that render the
header-main-navi.tpl with both an empty $userLabel and a non-empty $userLabel
and assert the output contains the expected label: when $userLabel is empty
assert the rendered HTML includes the fallback string "User" (matching the
__('User') translation) and when $userLabel is non-empty assert it includes that
exact label; locate the template logic around $displayName and $userLabel in
header-main-navi.tpl and use the project’s template-rendering helper to render
the template in tests, keeping tests independent (no external services) and
naming them clearly for the empty-label and non-empty-label scenarios.
- Around line 107-113: The fallback for the user label is only computed inside
the else branch, so when $settingsMenu is present the earlier render (the one at
Line 78) outputs an empty label; move the computation of $displayName =
!empty($userLabel) ? $userLabel : __('User') up above the conditional that
checks $settingsMenu so both branches reuse $displayName, remove the duplicated
assignment in the else branch, and ensure the template uses that single
$displayName variable wherever the user label is rendered.

Comment thread views/templates/blocks/header-main-navi.tpl

@Karol-Stelmaczonek Karol-Stelmaczonek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants