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

feat: Enable taxonomy/tagging feature in MFE by default #34633

Conversation

rpenido
Copy link
Contributor

@rpenido rpenido commented Apr 25, 2024

Description

This PR sets the tagging feature as enabled by default and creates a new waffle flag, content_tagging.disabled, to allow the feature to be turned off.

Testing Instructions

  1. Delete the following Waffle flags using the Django admin:
  • new_studio_mfe.use_tagging_taxonomy_list_page
  • content_tagging.auto
  1. Check if the tagging feature is enabled in the course authoring MFE:
  • In the course authoring home page, you should see the Taxonomy tab (http://apps.local.edly.io:2001/course-authoring/home)
  • In the Course Outline, you should see a "Manage Tags" link in the Course Header and the Section/Subsection menus.
  • In the Unit Outline, you should see the Tags card in the sidebar
  1. Create a Waffle flag with name content_tagging.disabled and set it to True to everyone
  2. Check if the taxonomy feature is disabled in the places above

Private ref: FAL-3708

@openedx-webhooks
Copy link

openedx-webhooks commented Apr 25, 2024

Thanks for the pull request, @rpenido! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

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

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

👍 @rpenido Great work, looks good to me!

  • I tested this: I followed the instructions in the PR
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

Comment on lines 5 to 6

def create_flags(apps, schema_editor):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add more more blank line/space between the imports and function def. Not sure why the linter in the CI didn't catch it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for noticing this! Fixed here: 720ce0b30fadc2202a43030ee3be279e0d090204

@bradenmacdonald
Copy link
Contributor

@rpenido Do we really need a migration for this? Can't we just change the default in the code?

@rpenido
Copy link
Contributor Author

rpenido commented Apr 26, 2024

@rpenido Do we really need a migration for this? Can't we just change the default in the code?

I will check/test it, but it makes sense to work only to changing the default.

@rpenido
Copy link
Contributor Author

rpenido commented Apr 29, 2024

Hi @bradenmacdonald ! From my research, it is not possible to do it easily without a migration. We have the WAFFLE_FLAG_DEFAULT, but I didn't find any way to do it in a per-flag way.

Also, we use migrations to set defaults in our codebase:

Let me know what you think!

@rpenido rpenido marked this pull request as ready for review April 29, 2024 11:57
@bradenmacdonald
Copy link
Contributor

@rpenido OK, I guess a migration is fine. BTW This might be a good time to rename the flag to enable_tagging_feature which is much more clear than enable_tagging_taxonomies_list_page. We want it to control both the "Taxonomies" page in Studio and the "Manage Tags" option on the outline/unit pages.

Also, I'm not sure if the "Automatic tagging" has been tested well enough to turn it on by default yet - let me ask about that.

@bradenmacdonald
Copy link
Contributor

@rpenido Yeah, I just checked with @jmakowski1123 and since the "automatic tagging" hasn't been tested enough (and probably won't be), we want to leave it off by default.

So, if you want, one option is to replace enable_tagging_taxonomies_list_page with a new flag called disable_tagging_feature that defaults to False - then no migration is required. I think that would be my preference. But you can also keep the current flag and make it enabled with a migration.

@rpenido
Copy link
Contributor Author

rpenido commented Apr 29, 2024

So, if you want, one option is to replace enable_tagging_taxonomies_list_page with a new flag called disable_tagging_feature that defaults to False - then no migration is required. I think that would be my preference.

Sure @bradenmacdonald! I will make this change and let you know when it's ready to review again!

But in that case, I think we would still want a migration to clean the old flag from database as it will not be used anymore and may cause confusion. Or you think this is not necessary?

@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch 4 times, most recently from f581786 to 0d5fe4f Compare April 30, 2024 19:22
@bradenmacdonald
Copy link
Contributor

@rpenido That's not necessary - the waffle flag has never been included in a release version, so it's likely only a few of us developers that have it.

@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch 2 times, most recently from 3be828e to 014295c Compare April 30, 2024 20:31
@rpenido rpenido marked this pull request as draft April 30, 2024 20:48
@@ -150,6 +150,6 @@ def test_number_of_calls_to_db(self):
"""
Test to check number of queries made to mysql and mongo
"""
with self.assertNumQueries(29, table_ignorelist=WAFFLE_TABLES):
with self.assertNumQueries(31, table_ignorelist=WAFFLE_TABLES):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are from the tag count queries

Copy link
Contributor

Choose a reason for hiding this comment

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

Now +3: (1 for the course as a whole, 1 for all the blocks in the course, and 1 for getting the org-specific value of COURSE_AUTHORING_MICROFRONTEND_URL (within get_course_authoring_url within get_taxonomy_tags_widget_url within _get_course_index_context).

@@ -717,7 +717,7 @@ def test_number_of_calls_to_db(self):
"""
Test to check number of queries made to mysql and mongo
"""
with self.assertNumQueries(26, table_ignorelist=WAFFLE_TABLES):
with self.assertNumQueries(28, table_ignorelist=WAFFLE_TABLES):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are from the tag count queries

@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch 3 times, most recently from 8fe6de5 to e5640c1 Compare May 1, 2024 10:46
@rpenido rpenido requested a review from yusuf-musleh May 1, 2024 10:51
@rpenido rpenido marked this pull request as ready for review May 1, 2024 10:51
@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch from e5640c1 to b272763 Compare May 1, 2024 10:53
Copy link
Contributor

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

@rpenido Thanks for your work on this! It's almost there, I've gone through the testing steps for this and noticed a few issues:

After deleting the tags mentioned in the testing instructions, by default the manage tags and taxonomies tabs/buttons appear as expected. However, when I try the new content_tagging.disabled flag, it only hides the Taxonomies tab in the course authoring mfe, however the "manage tags" buttons still appear. I left a comment in the mfe PR.

Also in legacy studio UI, the manage tags no longer appears regardless of the flag being set or not, that is because there is some missing code needed below.

cms/static/js/views/xblock_outline.js Show resolved Hide resolved
cms/templates/studio_xblock_wrapper.html Outdated Show resolved Hide resolved
@bradenmacdonald
Copy link
Contributor

Great review @yusuf-musleh - thanks :)

@bradenmacdonald
Copy link
Contributor

@yusuf-musleh Can you please take another look at this? It should be ready to go now.

Copy link
Contributor

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

👍 @bradenmacdonald Looks good to me, its working well now!

  • I tested this: I followed the testing instructions in the PR
  • I read through the code
  • I checked for accessibility issues
  • includes documentation

@bradenmacdonald
Copy link
Contributor

I tested this and it should be safe to merge before the associated course-authoring PR. Tagging features will still be disabled on edx.org. I already asked them to proactively set the content_tagging.disabled flag on their instance, which they did.

Copy link
Contributor

@ormsbee ormsbee left a comment

Choose a reason for hiding this comment

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

Minor nit in that I think it's more clear to always have the function be is_xxxxxx_enabled() and then have it do the right thing when switching waffle flags. But I certainly won't hold this up over that.

bradenmacdonald added a commit to open-craft/edx-platform that referenced this pull request May 8, 2024
…ure-in-mfe-by-default' into taxonomy-sandbox-20240508
…/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default
@farhaanbukhsh farhaanbukhsh merged commit b42da74 into openedx:master May 9, 2024
80 checks passed
@farhaanbukhsh farhaanbukhsh deleted the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch May 9, 2024 13:27
@openedx-webhooks
Copy link

@rpenido 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

rayzhou-bit pushed a commit that referenced this pull request May 9, 2024
* feat: make tagging feature enabled by default

* fix: use the correct flag for tagging enabled

* fix: make compatible with other changes from master

* fix: more compatibility fixes

* fix: show tag counts at all levels of the outline, not just units

* chore: typo

* test: fix counts in test suite now that tagging is on by default

---------

Co-authored-by: Braden MacDonald <[email protected]>
Co-authored-by: Yusuf Musleh <[email protected]>
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.

7 participants