att / rcloud

Collaborative data analysis and visualization
http://rcloud.social
MIT License
430 stars 142 forks source link

changing notebook type as non-author fails and opens the original type #2563

Closed s-u closed 6 years ago

s-u commented 6 years ago

Changing the type of someone else's notebook fails (ie. the type is not changed) and it triggers opening of the notebook at the (typically incorrect) original type.

For example, selecting "notebook.R" for a "view.html" notebook opens the "view.html" of the notebook and doesn't change the type.

It is unclear if it is intended for non-authors to change the type for themselves (it would be useful since authors may not set the correct type), but if it's not supported (what if the author sets a new type?) either the menu shouldn't be there or it should at least open the selected type or it should cause an error. Currently, it does the least-expected thing which is equivalent of opening the notebook it the old (mostly incorrect) type.

Ideally, it should keep the setting. If that's not intended, then it should at least open the newly selected type without changing the setting.

gordonwoodhull commented 6 years ago

Nods.

Currently we only allow non owners to set cache-like properties of notebooks, the stuff you get back from a gist service:

.anyone.settable = c('source', 'username', 'description', 'last_commit');

(source)

We could also allow changing 'view-type' for others' notebooks as it would probably not be abused. Or as you say, we could just open the notebook as the selected type but not save it. Either is OK with me.

gordonwoodhull commented 6 years ago

To be safe, I implemented this without allowing users to change each others' view types.

The item you select in the dropdown is always invoked, and this always changes the default for this session (which you get when clicking the sharable link button), indicated by the bolded item.

If you own the notebook, the view-type for the notebook is changed in RCS and will be retained the next time you load the page. Otherwise it reverts to whatever the author has set.