mitodl / ocw-studio

Open Source Courseware authoring tool
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Course publish without metadata (unforked) #2183

Closed ibrahimjaved12 closed 1 month ago

ibrahimjaved12 commented 1 month ago

What are the relevant tickets?

Fixes #1996 This is a copy of this PR https://github.com/mitodl/ocw-studio/pull/2015. The original PR is based off forked repository, due to which we couldn't run all workflow checks.

Description (What does it do?)

You can add content to a course and publish it in staging without ever visiting the Metadata section. Production, however will require metadata to be set.

Screenshots (if appropriate):

Screenshot 2023-10-20 at 2 34 36 PM Screenshot 2023-10-20 at 2 35 37 PM Screenshot 2023-10-20 at 2 35 51 PM

How can this be tested?

Additional Context

The course-v2/layouts/partials/course_banner.html file was changed in the ocw-hugo-themes repository. You can view the changes here

ibrahimjaved12 commented 1 month ago

@umar8hassan The changes here have a critical side effect. They don't allow us to publish ocw-www to live anymore, with the same validation required that "metadata" is required before we can publish. But ocw-www will not have metadata.

In static/js/components/PublishDrawer.tsx:

  const isPublishDisabled =
    !publishingInfo.hasUnpublishedChanges ||
    (!website.has_site_metadata && publishingEnv === PublishingEnv.Production)

For ocw-www, website.has_site_metadata will always return false. Looking at the ticket, I don't think we're required to have any kind of checks for ocw-www either way. There could be different ways to go about this to allow publishing ocw-www into live. We have name, short_id, title, starter in type Website each which would be distinct for ocw-www.

Please make changes for this as you see fit.

ibrahimjaved12 commented 1 month ago

Looks good to me 👍🏻

umar8hassan commented 1 month ago

@pdpinch this is has been tested on RC. Wanted to have your take on this before deploying it to production.