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: convert notification banner to text if accounts url is not set #362

Merged

Conversation

asadali145
Copy link
Contributor

@asadali145 asadali145 commented Oct 2, 2024

Description

The notification banner is always visible and cannot be dismissed. If ACCOUNT_SETTINGS_URL is not set, it redirects to <ora_grading>/notifications, which is not a valid URL.

This PR displays text instead of a link when the ACCOUNT_SETTINGS_URL is not set.

Screenshots

Before:

Screenshot 2024-10-02 at 2 28 24 PM

After (If ACCOUNT_SETTINGS_URL is not set):

Screenshot 2024-10-03 at 8 30 56 PM

After (If ACCOUNT_SETTINGS_URL is set):

Screenshot 2024-10-03 at 8 27 47 PM

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 2, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @asadali145!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/openedx-unmaintained. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (91e3374) to head (b014d97).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #362   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          111       111           
  Lines         1082      1088    +6     
  Branches       159       165    +6     
=========================================
+ Hits          1082      1088    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@asadali145 asadali145 changed the title feat: make notification banner dismissible fix: convert notification banner to text if accounts url is not set Oct 3, 2024
@asadali145 asadali145 force-pushed the asad/update-notifications-banner branch from 8d3709e to 011c6fe Compare October 3, 2024 15:36
@asadali145 asadali145 mentioned this pull request Oct 7, 2024
</Hyperlink>
{
isEmpty(getConfig().ACCOUNT_SETTINGS_URL) ? (
<FormattedMessage {...messages.notificationsBannerLinkMessage} />
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels a little odd to me to have the notificationsBannerLinkMessage only be a link sometimes. I think it makes more sense to have 2 (technically 3) fully independent strings:

  • infoMessage + notificationsBannerLinkMessage when we have an ACCOUNT_SETTINGS_URL
  • Something else entirely when we do not have an ACCOUNT_SETTINGS_URL

Another option that may be simpler would just be renaming notificationsBannerLinkMessage to notificationsBannerPreferencesCenterMessage.

@sarina which option we choose feels a little like a product question to me. Should I tag someone to get a product opinion? If not I'd be happy to merge this with the rename to notificationsBannerPreferencesCenterMessage as that feels like a smaller change.

Copy link

Choose a reason for hiding this comment

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

well for i18n you should embed the URL within the phrase, not concat them, if that's what you're suggesting.

I think the easiest is to rename the message. I think there's a separate DEPR for removing this banner altogether.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me!

@asadali145 - if notificationsBannerLinkMessage is renamed to notificationsBannerPreferencesCenterMessage this PR will look ready to merge to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brian-smith-tcril thanks for the review. PR is ready.

@@ -1,4 +1,5 @@
import React from 'react';
import { isEmpty } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know all the possible "empty" values that getConfig().ACCOUNT_SETTINGS_URL returns? I'd prefer we avoid adding a lodash dependency to this file if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I have replaced the lodash check with the values check. Could you please have another look?

Also, Just a reminder that we have another CTA banner removal PR that's pending for review #347.

Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

Thank you for updating the logic not not require lodash!

@asadali145
Copy link
Contributor Author

@brian-smith-tcril Could you please merge this?

@brian-smith-tcril
Copy link
Contributor

@asadali145 it looks like this PR needs a rebase as branch protections require it not be out-of-date with the base branch. Would you be able to update it? Once that's done I can hit the merge button.

@asadali145 asadali145 force-pushed the asad/update-notifications-banner branch from a448045 to b014d97 Compare November 4, 2024 16:46
@asadali145
Copy link
Contributor Author

@brian-smith-tcril Thank you, I just rebased and the checks are passing.

@brian-smith-tcril brian-smith-tcril merged commit c9d0abe into openedx:master Nov 4, 2024
7 checks passed
asadali145 added a commit to mitodl/frontend-app-ora-grading that referenced this pull request Dec 10, 2024
…penedx#362)

* fix: convert banner to text if ACCOUNT_SETTINGS_URL is not set

* refactor: refactoring

* refactor: rename notificationsBannerLinkMessage to notificationsBannerPreferencesCenterMessage

* refactor: remove lodash usage

* refactor: remove lodash usage
brian-smith-tcril pushed a commit that referenced this pull request Dec 10, 2024
…362) (#385)

* fix: convert banner to text if ACCOUNT_SETTINGS_URL is not set

* refactor: refactoring

* refactor: rename notificationsBannerLinkMessage to notificationsBannerPreferencesCenterMessage

* refactor: remove lodash usage

* refactor: remove lodash usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants