-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't break profile page if a mod has no default_version #261
Don't break profile page if a mod has no default_version #261
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the most important part is trying to find out what can cause a mod without a default_version
field. Otherwise, we'd have to extend this null check everywhere in the code.
I have an idea to test, maybe mods without default_version
are created if the upload fails.
In case anyone else has the same idea I had, you can't delete the default version: SpaceDock/KerbalStuff/blueprints/mods.py Lines 471 to 472 in d20ef12
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just move the if
block to hide the entire div if the mod doesn't have a default version 😄 .
74cfb1f
to
cbac8f4
Compare
Should hide the full |
Problem
Currently, if for some, theoretically impossible, reason a mod of an author has no
default_version
, viewing their profile results in a 500.(If the mod is still unpublished, it only results in a 500 for the author)
The cause of the error are the mod boxes, that are accessing
mod.default_version.gameversion
to display theFor ...
message in the corner. Ifmod.default_version
isNone
, an exception is thrown.Changes
mod-box.html
checks ifmod.default_version
isNone
, and if so, displays an-
instead of the KSP version.Also the flask route is enhanced to also show unpublished mods to admins.
TODO
There are still many other places left where we are accessing
mod.default_version
without null-checks, for example the mod page itself.They have to be fixed separately, which is more work.
If we want to allow mods without any releases, we'd have to do this work.
Otherwise, we could try to make the
Mod.default_version_id
column non-nullable. This needs a rather complex data migration to make sure there are no mods withdefault_version_id=None
left, but I already have some code for that.Most important, we have to find out, where
Mod.default_version
can be set toNone
currently and fix that.