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

Fix support link empty bug #26140

Closed
wants to merge 1 commit into from

Conversation

zainab-amir
Copy link
Contributor

If support link is not sent, configuration helper returns empty dictionary instead of string. This causes issue on frontend when it tries to set href using this link.

If support link is not sent, configuration helper returns empty
dictionary instead of string. This causes issue on frontend when it
tries to set href using this link
@@ -180,7 +180,7 @@ def _log_and_raise_inactive_user_auth_error(unauthenticated_user):
error_code='inactive-user',
context={
'platformName': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'supportLink': configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK)
'supportLink': configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK) or ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn’t it fallback to settings.SUPPORT_SITE_LINK if it's not set in the site configuration which actually is an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently on my local devstack both these values are not set

  • My site config do not have anything
  • SUPPORT_SITE_LINK = ''

but when I debug and run this statement as whole it returns {}

> configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK)
{}

Copy link
Contributor

Choose a reason for hiding this comment

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

That is I guess a bug in this code https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/site_configuration/helpers.py#L118-L129 which is expecting to raise an exception upon updating a non-dict object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will look into it and update the change

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

One thing to notice here is that this only happens if the default value is an empty string instead of None. If the configuration is not defined and the default is a None then it works as expected.

@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@arch-bom-gocd-alerts
Copy link

📣 💥 Heads-up: You must either rebase onto master or merge master into your branch to avoid breaking the build.

We recently removed diff-quality and introduced lint-amnesty. This means that the automated quality check that has run on your branch doesn't work the same way it will on master. If you have introduced any quality failures, they might pass on the PR but then break the build on master.

This branch has been detected to not have commit 2e33565 as an ancestor. Here's how to see for yourself:

git merge-base --is-ancestor 2e335653 zamir/fix_support_link_empty_bug && echo "You're all set" || echo "Please rebase onto master or merge master to your branch"

If you have any questions, please reach out to the Architecture team (either #edx-shared-architecture on Open edX Slack or #architecture on edX internal).

@zainab-amir
Copy link
Contributor Author

Fixed the issue in another PR: https://github.com/edx/edx-platform/pull/28577

@zainab-amir zainab-amir deleted the zamir/fix_support_link_empty_bug branch August 30, 2021 13:12
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.

4 participants