Skip to content

Conversation

AstroMC98
Copy link
Contributor

Purpose

Fix file upload button behavior in Ask page to properly restrict access based on authentication status.

Problem: The UploadFile component in Ask.tsx was using disabled={loggedIn} which incorrectly disabled the button when users were logged in and enabled it when users were not logged in - the opposite of the intended behavior.

Solution: Changed the disabled prop to disabled={!loggedIn} to match the same authentication logic used in Chat.tsx, ensuring that:

  • File upload functionality is disabled when no user is logged in
  • File upload functionality is enabled when a user is authenticated
  • Consistent behavior across both Ask and Chat pages

Impact: This ensures proper access control for file upload features and maintains consistent user experience throughout the application.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[X] No

Type of change

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.

…ot Logged in

Modified loggedIn to !loggedIn in Line 288 such that it follows the same logic as Chat.tsx
@pamelafox
Copy link
Collaborator

Thank you for the PR, I'll review tomorrow in my logged-in demo environment.

@pamelafox
Copy link
Collaborator

Verified the fix, thanks! The e2e tests dont yet cover logged in scenarios, so we aren't able to add an end-to-end test verifying the change, but I wouldn't expect a regression for this going forward. Merging!

@pamelafox pamelafox merged commit 6be648a into Azure-Samples:main May 27, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants