From eb2cb9e9218c53e4e9f7c72bf35ba0ae60da7c7c Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Thu, 15 Dec 2022 11:34:07 -0600 Subject: [PATCH] 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 --- test/api/v4/faq/GET-faq.test.js | 4 + website/client/src/components/static/faq.vue | 97 +++++++++----------- website/client/src/store/actions/faq.js | 7 ++ website/client/src/store/actions/index.js | 2 + website/common/locales/en/faq.json | 2 + website/common/script/content/faq.js | 70 ++++++++++++-- website/server/controllers/api-v4/faq.js | 1 + 7 files changed, 120 insertions(+), 63 deletions(-) create mode 100644 website/client/src/store/actions/faq.js diff --git a/test/api/v4/faq/GET-faq.test.js b/test/api/v4/faq/GET-faq.test.js index 5c7ab31ce6..f18eddd625 100644 --- a/test/api/v4/faq/GET-faq.test.js +++ b/test/api/v4/faq/GET-faq.test.js @@ -37,6 +37,8 @@ describe('GET /faq', () => { expect(res).to.have.property('questions'); expect(res.questions[0]).to.eql({ + exclusions: [], + heading: 'overview', question: translate('faqQuestion0'), ios: translate('iosFaqAnswer0'), }); @@ -57,6 +59,8 @@ describe('GET /faq', () => { expect(res).to.have.property('questions'); expect(res.questions[0]).to.eql({ + exclusions: [], + heading: 'overview', question: translate('faqQuestion0'), android: translate('androidFaqAnswer0'), }); diff --git a/website/client/src/components/static/faq.vue b/website/client/src/components/static/faq.vue index 783270f2bc..f4ed0faefd 100644 --- a/website/client/src/components/static/faq.vue +++ b/website/client/src/components/static/faq.vue @@ -5,40 +5,44 @@ >
-

+

{{ $t('frequentlyAskedQuestions') }}

-
-

- {{ $t(`faqQuestion${index}`) }} -

- -
-
-
+ {{ entry.question }} + + +
+

-

+

@@ -46,7 +50,7 @@