Open Alys opened 3 years ago
I think it's happening because the summary is not always populated, I think we can fix it easily
For now, we'd like for the client to require the summary for all new challenges moving forward, which should help prevent the reappearance of this issue but shouldn't break the API.
Ideally this will be more neatly repaired on the eventual transition to APIv4.
we'd like for the client to require the summary for all new challenges moving forward
Do we want to have this validation on the client side or the server side? Sorry if I've just completely misunderstood, but since it looks like the validation is enforced on the client side, what we want to do here is to validate the summary is not empty in the api controller, right?
First some background information:
Challenges have a
summary
field but it's not mandatory. That's because if we'd made it mandatory when we added it to the challenge model, that would have been a breaking change for the API. If you view a Challenge that does not have a summary in the Challenge's own page, then you see the Challenge's title in the place where the summary would go (but if you look at the raw data in the database, you see that the summary is empty). For example, this challenge has no summary: https://habitica.com/challenges/930711e5-5958-4789-8758-c4aff17e8c51All that is working as required.
However when you fetch Challenges using the api/v3/challenges/user route, empty summary fields are not populated with the Challenges' titles.
Similarly, when you view Challenges in the sidebar of a Guild, empty summary fields are not populated with the Challenges' titles. See the screeshot below for an example from the Duolinguists of Habitica Guild (the third Challenge has no summary).
I'm marking this as suggestion-discussion for the staff to make a decision about whether the summary fields should be auto-populated in those two cases.
Thanks to cTheDragons for reporting this.