Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the subheader login link when there is already login button #280

Merged

Conversation

hongquan
Copy link
Member

@hongquan hongquan commented Feb 25, 2025

Fixes #276

The issue is that, in the /talk/<event>/login/ page, we have a login button and a top-right login link, which lead to different locations (and hence, different behavior).

The top-right link is global and seems to serve different purpose (for upstream pretalx setup), I don't know how to change its location in a safe way (to not break other pages and to keep it easy to maintain). So I choose to hide it in the /talk/<event>/login/. This page already have a prominent login button which we want users to focus in, having more link will confuse users.

To do this, I introduce a context variable subheader_login_link_disabled, to be passed to templates and let the link show / hide according to this variable.
I name it subheader because calling it top-right will confuse the Arabic UI user. In the future, we may support right-to-left languages and when displaying in those languages, the layout will be switched, the login link will be rendered on the left side.

How has this been tested?

image

Checklist

  • I have added tests to cover my changes.

Summary by Sourcery

This pull request disables the subheader login link on the event login page to avoid user confusion caused by having multiple login links. It introduces a context variable to control the visibility of the subheader login link.

Bug Fixes:

  • Fixes an issue where the login page for an event displayed two login links, potentially confusing users.

Enhancements:

  • Introduces a subheader_login_link_disabled context variable to control the visibility of the subheader login link in templates.

Copy link

sourcery-ai bot commented Feb 25, 2025

Reviewer's Guide by Sourcery

This pull request introduces a mechanism to disable the subheader login link on specific pages, such as the event login page, to avoid user confusion when there is already a primary login button. A new context variable, subheader_login_link_disabled, is used to control the visibility of the link in the base template.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Introduced a context variable to disable the subheader login link on specific pages.
  • Added a subheader_login_link_disabled variable to the context in the login view.
  • Set subheader_login_link_disabled to True in the login view to hide the subheader login link.
  • Modified the base template to check the subheader_login_link_disabled variable before rendering the login link.
src/pretalx/cfp/views/auth.py
src/pretalx/common/templates/common/base.html

Assessment against linked issues

Issue Objective Addressed Explanation
#276 The login button on the top right should direct the user to the login page if the user is not logged into the tickets component already, and automatically log in the user if they are already logged in. The PR disables the subheader login link instead of fixing its redirection behavior.
#276 The large green login button should display the login text. The PR does not address the missing login text on the large green login button. It only disables the subheader login link.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @hongquan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a setting to control the subheader link instead of a context variable.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hongquan
Copy link
Member Author

@sourcery-ai
The display of this "login link" is per page (view), not site-wide. If we use the settings, it will be applied on whole site. That is not what we want.

Copy link
Member

@norbusan norbusan left a comment

Choose a reason for hiding this comment

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

LGTM

@mariobehling mariobehling merged commit bfe9a8a into fossasia:development Feb 26, 2025
6 of 8 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.

Missing login button text and not login redirection on speakers area page
3 participants