HabitRPG / habitica

A habit tracker app which treats your goals like a Role Playing Game.
https://habitica.com
Other
11.94k stars 4.08k forks source link

empty Challenge Summary field is not replaced by Title in all API routes #12886

Open Alys opened 3 years ago

Alys commented 3 years ago

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-c4aff17e8c51

All 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).

image

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.

paglias commented 3 years ago

I think it's happening because the summary is not always populated, I think we can fix it easily

veeeeeee commented 3 years ago

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.

vimiomori commented 2 years ago

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?