Refactor FAQ (#14372)

* refactor(faq): fetch from API on web
Also make question list more maintainable, allowing different questions across platforms

* fix(tests): don't return null when function is expected
Also removes the unnecessary default to web in controller

* fix(tests): add new fields to expectation, add placeholders

* refactor(faq): allow reordering

Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
Sabe Jones
2022-12-15 11:34:07 -06:00
committed by GitHub
parent 580139ff69
commit eb2cb9e921
7 changed files with 120 additions and 63 deletions

View File

@@ -22,6 +22,7 @@ function _deleteProperties (obj, keysToDelete, platform) {
function _deleteOtherPlatformsAnswers (faqObject, platform) {
const faqCopy = _.cloneDeep(faqObject);
_.remove(faqCopy.questions, question => question.exclusions.indexOf(platform) !== -1);
const keysToDelete = _.without(['web', 'ios', 'android'], platform);
_deleteProperties(faqCopy.stillNeedHelp, keysToDelete, platform);