Skip to content

Check that the request has an user before building the auth menu#659

Merged
danniel merged 2 commits intomainfrom
bugfix/more-property-checks-for-requests
Feb 23, 2026
Merged

Check that the request has an user before building the auth menu#659
danniel merged 2 commits intomainfrom
bugfix/more-property-checks-for-requests

Conversation

@danniel
Copy link
Collaborator

@danniel danniel commented Feb 23, 2026

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Feb 23, 2026

Greptile Summary

Fixed a bug in build_auth_menu where requests without a user attribute would incorrectly return the admin menu instead of an empty menu. The fix adds a defensive check using hasattr(request, "user") at the start of the function, returning an empty list if the attribute is missing. This properly addresses the logic error from the previous commit where not user or ... would evaluate to True when user was None.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a simple, focused change that properly addresses a logic bug. The defensive check using hasattr is the correct approach for handling missing attributes, and the early return pattern prevents any downstream errors. The change doesn't introduce new complexity or edge cases.
  • No files require special attention

Important Files Changed

Filename Overview
backend/redirectioneaza/context_processors/headers.py Added defensive check for missing user attribute on request object, fixing bug where admin menu was incorrectly shown

Last reviewed commit: a9c8c10

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@danniel danniel requested a review from tudoramariei February 23, 2026 09:26
@danniel
Copy link
Collaborator Author

danniel commented Feb 23, 2026

@greptileai

@danniel danniel merged commit 1f368d7 into main Feb 23, 2026
9 checks passed
@danniel danniel deleted the bugfix/more-property-checks-for-requests branch February 23, 2026 10:33
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.

1 participant