openvibers/openvibe.quest Commits

Quest: the home says quests pay OpenCoins now that they do (#48)

OP OpenVibers committed 29 days ago · f95a93e800 · 3 files, +21 −3

Production has run with `QUEST_COINS=on` for a while: completions credit OpenCoins through Network's wallet. But the home page still said quests pay badges "(and OpenCoins, once they are switched on)", and its "Rewards are badges" card said the same. Each quest's page was already right (`coinsNote` reads the setting).

- The home lede and the card now follow `QUEST_COINS`: "rewards it with badges and OpenCoins" and "…and OpenCoins into your OpenVibe.Network wallet" when on; the old wording only while off.
- A stale comment in `server/search-index.js` said the coins are off.
- `test/quests-api.test.js` checks both settings.

Changes

ddiff --git a/server/http/pages.js b/server/http/pages.js
iindex 0713db2..77788c8 100644
---- a/server/http/pages.js
++++ b/server/http/pages.js
@@@ -54,7 +54,7 @@ function createPageRoutes(ctx) {
eyebrow: `${SITE_NAME} · ${TAGLINE}`,
title: 'Quests across OpenVibe.',
accent: 'Badges for what you really do.',
-- lede: `${SITE_NAME} is the network's shared quest log: one place that knows what you have really done on the OpenVibe sites it follows, and rewards it with badges (and OpenCoins, once they are switched on). Quest runs no activities of its own — it listens to what the sites already report, and nothing else.`,
++ lede: `${SITE_NAME} is the network's shared quest log: one place that knows what you have really done on the OpenVibe sites it follows, and rewards it with badges${coinsUi.coinsEnabled ? ' and OpenCoins' : ' (and OpenCoins, once they are switched on)'}. Quest runs no activities of its own — it listens to what the sites already report, and nothing else.`,
actions: signedIn(req)
? [{ label: 'Your quest log', href: '/me', primary: true }, { label: 'How it works', href: '/how-it-works' }]
: [{ label: 'Sign in to start', href: '/auth/login?next=%2Fme', primary: true }, { label: 'How it works', href: '/how-it-works' }],
@@@ -71,7 +71,7 @@ ${raw(showcase.features({
lede: 'One quest log across eight OpenVibe sites (Live, the Network, Community, Chat, the Wiki, Games, Tools and Space), built on what the sites already tell the network.',
items: [
{ icon: 'ov:page', title: 'One log, many sites', text: 'A stream on OpenVibe.Live, a thread on OpenVibe.Community, a message in OpenVibe.Chat: the same log, grouped by the site the event came from.' },
-- { icon: 'ov:account', title: 'Rewards are badges', text: 'A quest pays a badge that shows on your profile across the network and, once they are switched on, OpenCoins.' },
++ { icon: 'ov:account', title: 'Rewards are badges', text: coinsUi.coinsEnabled ? 'A quest pays a badge that shows on your profile across the network, and OpenCoins into your OpenVibe.Network wallet.' : 'A quest pays a badge that shows on your profile across the network and, once they are switched on, OpenCoins.' },
{ icon: 'ov:tools', title: 'OpenCoins, not Vibes', text: 'OpenCoins are loyalty points credited through OpenVibe.Network\'s wallet. They are never money, they are not Vibes, and Vibes are never touched here.' },
{ icon: 'ov:games', title: 'Made by communities next', text: 'Quests a streamer or a community writes themselves need moderation, which this release does not have yet. The tables and the API already key everything by quest id.' },
],
ddiff --git a/server/search-index.js b/server/search-index.js
iindex cd7ec74..620fa05 100644
---- a/server/search-index.js
++++ b/server/search-index.js
@@@ -4,7 +4,7 @@
* Quest's quest pages in OpenVibe.Search (openvibe-publishing/search-feed): one search.index-document@1 per quest
* (/quests/<id>), sent as quest.index_document.upserted|deleted through this service's events outbox. The document is
* what the page says: the quest's title, why it is worth doing, its steps, the site it happens on and the badge (and
-- * item) it gives. Not the OpenCoins: they are off until the reward economics are decided (QUEST_COINS), and Search
++ * item) it gives. Not the OpenCoins: whether they move is a setting (QUEST_COINS) and their amounts may change, and Search
* should never promise them.
*
* Quests are this service's own catalog (server/quests/catalog.js), so a sweep a minute after boot and every six
ddiff --git a/test/quests-api.test.js b/test/quests-api.test.js
iindex 27d3072..ca3acaf 100644
---- a/test/quests-api.test.js
++++ b/test/quests-api.test.js
@@@ -177,5 +177,23 @@ const { render } = require('../server/render/html');
assert.ok(!page.text.includes('<script>alert(1)'), 'the requested path is never echoed as markup');
});
} finally { await t.close(); }
++
++ // The home's OpenCoins wording follows QUEST_COINS: "once they are switched on" only while they are off.
++ const on = await boot({ env: { QUEST_COINS: 'on' } });
++ try {
++ await check('with QUEST_COINS=on the home says quests pay OpenCoins, not that they will', async () => {
++ const home = await on.get('/');
++ assert.strictEqual(home.status, 200);
++ assert.ok(!home.text.includes('once they are switched on'), 'no promise of something already on');
++ assert.ok(home.text.includes('rewards it with badges and OpenCoins'));
++ assert.ok(home.text.includes('OpenCoins into your OpenVibe.Network wallet'));
++ });
++ } finally { await on.close(); }
++ const off = await boot();
++ try {
++ await check('with QUEST_COINS off the home still says they come later', async () => {
++ assert.ok((await off.get('/')).text.includes('once they are switched on'));
++ });
++ } finally { await off.close(); }
done();
})().catch((err) => { console.error(err); process.exit(1); });