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: metadata fields for migration rules #2163

Merged

Conversation

HussainTaj-arbisoft
Copy link
Contributor

@HussainTaj-arbisoft HussainTaj-arbisoft commented Apr 23, 2024

What are the relevant tickets?

Relates to mitodl/ocw-hugo-projects#292

Description (What does it do?)

With mitodl/ocw-hugo-projects#292 merged, the default metadata will have a title field. When migration is run on older data to create new external resource objects, those objects will have a title in their metadata field. This will cause the menu item selection UI to misbehave on Studio. This is because it prefers website_content.metadata.title over website_content.title (which is the default location of the title).

This PR prevents title from being added to the metadata and keeps the structure consistent with what normal flow gets us.

This PR also fixes a spelling error in a field name has_external_licence_warning -> has_external_license_warning.

How can this be tested?

  1. Navigate to your local ocw-studio setup.
  2. Checkout branch external-resource-add-title-field.
  3. Start/Restart Studio.
  4. Follow the instructions in config(course): add title update license fields ocw-hugo-projects#292 to load the starter config.
  5. Create a course.
  6. Create a page in that course.
  7. Create a markdown link on that page.
  8. Save the page.
  9. Run the following set of commands.
    docker compose exec web ./manage.py markdown_cleanup link_to_external_resource --skip-sync --commit --filter your-course-id
  10. Open Django admin.
  11. Expect to see new content created for the markdown link.
  12. Open that new content object.
  13. Observe the metadata field.
  14. Expect to NOT find any title field.
  15. Expect to find a has_external_license_warning field with these exact spellings.

@pt2302 pt2302 self-assigned this Apr 23, 2024
@pt2302 pt2302 self-requested a review April 23, 2024 13:22
Copy link
Contributor

@pt2302 pt2302 left a comment

Choose a reason for hiding this comment

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

Looks good to me! One important note is that the management command markdown_cleanup will only work for published courses, so the testing instructions should indicate that the course needs to published first. Alternatively, an existing course that has already been published can also be used for testing.

@HussainTaj-arbisoft HussainTaj-arbisoft merged commit e8a0d1d into master Apr 29, 2024
7 checks passed
@HussainTaj-arbisoft HussainTaj-arbisoft deleted the hussaintaj/external-resource-add-title-field branch April 29, 2024 13:08
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants