Skip to content
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

feat(faq): update questions and answers #14921

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
eedfa57
well, at least the questions are showing up
CuriousMagpie Sep 13, 2023
1bac3f6
Got sidebar working, issues with flex on collapse/open
CuriousMagpie Sep 22, 2023
f7c7125
removed some padding on borders
CuriousMagpie Sep 22, 2023
d762295
Fixed sidebar in place and checked main body styling was consistent w…
CuriousMagpie Sep 25, 2023
0051f56
Fiddling with margins
CuriousMagpie Sep 25, 2023
06f733f
Added a little padding at the bottom if all current questions are clo…
CuriousMagpie Sep 26, 2023
6fb5ab2
Fix padding on answers
CuriousMagpie Oct 4, 2023
2ef98ac
feat(faq): update questions 1 through 10
CuriousMagpie Oct 5, 2023
394c967
feat(faq): questions 11 through 40
CuriousMagpie Oct 6, 2023
d36ddb0
Fix duplicate string
CuriousMagpie Oct 6, 2023
1f27711
Updated test/content/faq to remove iOS references
CuriousMagpie Oct 6, 2023
9bfecb1
Updated test/api/v4/faq/GET-faq.test.js to remove references to iOS a…
CuriousMagpie Oct 6, 2023
40d6b60
update packages on local/origin repo
CuriousMagpie Oct 23, 2023
581271e
Reporting challenges (#14756)
CuriousMagpie Oct 24, 2023
bc358c3
5.10.0
SabreCat Oct 24, 2023
9385dea
Merge branch 'develop' into faq-questions-update
CuriousMagpie Oct 25, 2023
0f74617
feat(faq): update translation indices
CuriousMagpie Oct 25, 2023
40b14df
Updated test/api/v4/faq/GET-faq.test.js to update first index to 25 f…
CuriousMagpie Oct 25, 2023
aa58aee
correct test errors
CuriousMagpie Oct 25, 2023
964750b
updated test/api/v4/faq/GET-faq.test.js to update indices on line 15
CuriousMagpie Oct 25, 2023
2959a94
update test/api/v4/faq/GET-faq.test.js for what better be the last ti…
CuriousMagpie Oct 25, 2023
dbf2f8e
Merge branch 'release' into faq-questions-update
SabreCat Oct 27, 2023
276cfd6
fix(faq): don't return android/ios specific answer
SabreCat Oct 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "5.9.1",
"version": "5.10.0",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.22.10",
Expand Down
62 changes: 62 additions & 0 deletions test/api/v3/integration/challenges/POST-challenge_flag.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { v4 as generateUUID } from 'uuid';
import {
generateChallenge,
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-integration/v3';

describe('POST /challenges/:challengeId/flag', () => {
let user;
let challenge;

beforeEach(async () => {
const { group, groupLeader } = await createAndPopulateGroup({
groupDetails: {
name: 'TestParty',
type: 'party',
privacy: 'private',
},
members: 1,
});

user = groupLeader;

challenge = await generateChallenge(user, group);
});

it('returns an error when challenge is not found', async () => {
await expect(user.post(`/challenges/${generateUUID()}/flag`))
.to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('challengeNotFound'),
});
});

it('flags a challenge', async () => {
const flagResult = await user.post(`/challenges/${challenge._id}/flag`);

expect(flagResult.challenge.flags[user._id]).to.equal(true);
expect(flagResult.challenge.flagCount).to.equal(1);
});

it('flags a challenge with a higher count when from an admin', async () => {
await user.update({ 'contributor.admin': true });

const flagResult = await user.post(`/challenges/${challenge._id}/flag`);

expect(flagResult.challenge.flags[user._id]).to.equal(true);
expect(flagResult.challenge.flagCount).to.equal(5);
});

it('returns an error when user tries to flag a challenge that is already flagged', async () => {
await user.post(`/challenges/${challenge._id}/flag`);

await expect(user.post(`/challenges/${challenge._id}/flag`))
.to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('messageChallengeFlagAlreadyReported'),
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { v4 as generateUUID } from 'uuid';
import {
generateChallenge,
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-integration/v3';

describe('POST /challenges/:challengeId/clearflags', () => {
let admin;
let nonAdmin;
let challenge;

beforeEach(async () => {
const { group, groupLeader, members } = await createAndPopulateGroup({
groupDetails: {
name: 'TestParty',
type: 'party',
privacy: 'private',
},
members: 1,
});

admin = groupLeader;
[nonAdmin] = members;

await admin.update({ 'permissions.moderator': true });

challenge = await generateChallenge(admin, group);
await admin.post(`/challenges/${challenge._id}/flag`);
});

it('returns error when non-admin attempts to clear flags', async () => {
await expect(nonAdmin.post(`/challenges/${generateUUID()}/clearflags`))
.to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('messageGroupChatAdminClearFlagCount'),
});
});

it('returns an error when challenge is not found', async () => {
await expect(admin.post(`/challenges/${generateUUID()}/clearflags`))
.to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('challengeNotFound'),
});
});

it('clears flags and sets mod flag to false', async () => {
await nonAdmin.post(`/challenges/${challenge._id}/flag`);
const flagResult = await admin.post(`/challenges/${challenge._id}/clearflags`);

expect(flagResult.challenge.flagCount).to.eql(0);
expect(flagResult.challenge.flags).to.have.property(admin._id, false);
expect(flagResult.challenge.flags).to.have.property(nonAdmin._id, true);
});
});
29 changes: 1 addition & 28 deletions test/api/v4/faq/GET-faq.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('GET /faq', () => {
expect(res).to.have.property('stillNeedHelp');
expect(res.stillNeedHelp.ios).to.equal(translate('iosFaqStillNeedHelp'));
expect(res).to.have.property('questions');
expect(res.questions[0].question).to.equal(translate('faqQuestion0'));
expect(res.questions[0].question).to.equal(translate('faqQuestion25'));
});

it('returns faq not in English', async () => {
Expand All @@ -29,20 +29,6 @@ describe('GET /faq', () => {
});

describe('platform parameter', () => {
it('returns faq with answers for ios platform only', async () => {
const res = await requester().get('/faq?platform=ios');

expect(res).to.have.property('stillNeedHelp');
expect(res.stillNeedHelp).to.eql({ ios: translate('iosFaqStillNeedHelp') });

expect(res).to.have.property('questions');
expect(res.questions[0]).to.eql({
exclusions: [],
heading: 'overview',
question: translate('faqQuestion0'),
ios: translate('iosFaqAnswer0'),
});
});
it('returns an error when invalid platform parameter is specified', async () => {
const request = requester().get('/faq?platform=wrong');
await expect(request)
Expand All @@ -52,18 +38,5 @@ describe('GET /faq', () => {
message: i18n.t('invalidReqParams'),
});
});
it('falls back to "web" description if there is no description for specified platform', async () => {
SabreCat marked this conversation as resolved.
Show resolved Hide resolved
const res = await requester().get('/faq?platform=android');
expect(res).to.have.property('stillNeedHelp');
expect(res.stillNeedHelp).to.eql({ web: translate('webFaqStillNeedHelp') });

expect(res).to.have.property('questions');
expect(res.questions[0]).to.eql({
exclusions: [],
heading: 'overview',
question: translate('faqQuestion0'),
android: translate('androidFaqAnswer0'),
});
});
});
});
10 changes: 0 additions & 10 deletions test/content/faq.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ describe('FAQ Locales', () => {
});
});

it('has a valid ios answers', () => {
each(questions, question => {
expectValidTranslationString(question.ios);
});
});

it('has a valid web answers', () => {
each(questions, question => {
expectValidTranslationString(question.web);
Expand All @@ -29,10 +23,6 @@ describe('FAQ Locales', () => {
});

describe('Still Need Help Message', () => {
it('has a valid ios message', () => {
expectValidTranslationString(stillNeedHelp.ios);
});

it('has a valid web message', () => {
expectValidTranslationString(stillNeedHelp.web);
});
Expand Down
32 changes: 16 additions & 16 deletions website/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading