news-catalyst / google-app-scripts

a collection of scripts for tinynews google docs add-ons
https://script.google.com/a/newscatalyst.org/d/1ILURq69o3cYUy6k1n1X6HwxdMfl9xWNhILYuZxgLfeblb3IR15WCMZSj/edit
1 stars 1 forks source link

Bugfix: store document type on new or existing articles/pages #319

Closed jacqui closed 3 years ago

jacqui commented 3 years ago

Closes #318

The bug was due to the sidebar not knowing what kind of content this document was: an article or a static page. The line of code that set this value had been moved and was relying on the page to already have an ID, which is why we didn't catch it.

When I tried to add a new page to the new test org I'm working with, I realized the problem. The fix was very simple - I just had to set the doc type to page or article before checking if it already existed.

Along the way I noticed that the source tracking form was showing up on the static page sidebar, and that the confirmation dialog was happening on publishing static pages. I hid both of these for static pages, and I verified that preview + publish continues to work as expected on articles.

To test, make a new doc in the pages folder in an org, add the new doc to the script editor's test list with "latest code" and verify you can preview and publish it.