codevise / pageflow

Multimedia story telling for the web.
http://pageflow.io
MIT License
689 stars 125 forks source link

Filter out widgets of unknown widget types #1961

Closed tf closed 1 year ago

tf commented 1 year ago

When a widget type is defined within a feature, revisions and entry templates still may contain widgets of that type once the feature has been disabled.

So far, we assigned a null widget type in that case, which rendered the empty string. In published scrolled entries, these widgets then got filtered out when compiling seed data since they did not match the special :react insert point [1]. In the editor, these widgets were still included in collections, which led to JS errors when trying to look up the editor or frontend JS counter part of a widget. Here we fail loudly, when a widget type is not defined to make integration errors between JS and Ruby easy to spot.

While we still want to support widgets with null widget types for placeholders, we can skip widgets that do not have a corresponding widget type when passing data to the editor.

Same in entry template forms: If there is no widget type defined for a given role, we do not need to display drop down that will only contain the blank option.

We therefore filter out widget from the db with unknown type in the resolver.

REDMINE-20207

[1] https://github.com/codevise/pageflow/blob/06574ea6b677fdc823074df5f2769c9196a788ba/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb#L35