Closed klembot closed 6 years ago
Original comment by Thomas M. Edwards (Bitbucket: tmedwards, GitHub: tmedwards):
It seems like the most sensible thing to do is to prevent the user from deleting the format set as default.
Not a bad idea, though we should ensure that it doesn't violate the principle of least surprise—i.e. users must know why they cannot delete the the format, elsewise rage will likely ensue—so no silently hiding the delete button.
My first instinct is to change updatePrefs to update versions in the other part of your bug, but we would also need to fix it in the stories themselves, since format versions are stored there too.
Sounds good to me.
Original comment by Chris Klimas (Bitbucket: klembot, GitHub: klembot):
It seems like the most sensible thing to do is to prevent the user from deleting the format set as default. repairFormats runs before the UI has initialized so it's going to be awkward to try to ask questions then.
My first instinct is to change updatePrefs to update versions in the other part of your bug, but we would also need to fix it in the stories themselves, since format versions are stored there too.
Other alternative is to fix the dialogs instead, but I'd rather nip it in the bud at the data layer.
Original comment by Thomas M. Edwards (Bitbucket: tmedwards, GitHub: tmedwards):
Yes, they would silently get v2.16.0, however….
The point is that no valid story format is selected as the default preference in the Formats dialog, which is not an ideal situation for users regardless of the fact that Twine 2 will silently push v2.16.0 on them—the Change Story Format dialog has the same issue. Showing users dialogs without valid settings is a bad practice to get into and makes for a terrible UI.
Beyond that, new projects created while in this state will have the outdated preference set as their initial format, which is particularly bad because now we're pushing outdated prefs down the line.
Finally, if no similar format exists—e.g. the user installed a non-builtin format, made it default, and then uninstalled it—then things break hilariously as Twine 2 doesn't have a clue what to do when the user attempts to Play, Test, or Publish.
If we don't silently update the prefs as we silently muck with the formats in repairFormats()
, then we should either force the user to make a selection or, at the very least, display some kind of warning/error to let them know that their prefs are hosed—especially in the final case I outlined, where their story will be completely broken until some action is taken.
Originally reported by: Thomas M. Edwards (Bitbucket: tmedwards, GitHub: tmedwards)
Removal of formats in
repairFormats()
may leave the default story and proofing format preferences in a bad state as they do not get updated in the event that the formats they reference are deleted.I think the correct course of action in this case would be to:
Test Case
2.14.0
.2.16.0
.