import { authWithHeaders } from '../../middlewares/auth'; const api = {}; // @TODO export this const, cannot export it from here because only routes are exported from // controllers const LAST_ANNOUNCEMENT_TITLE = 'LAST CHANCE FOR SUMMER SPLASH OUTFITS, SUMMER AVATAR CUSTOMIZATIONS, MAGIC HATCHING POTIONS, AND SEAFOAM'; const worldDmg = { // @TODO bailey: false, }; /** * @api {get} /api/v3/news Get latest Bailey announcement * @apiName GetNews * @apiGroup News * * * @apiSuccess {Object} html Latest Bailey html * */ api.getNews = { method: 'GET', url: '/news', async handler (req, res) { const baileyClass = worldDmg.bailey ? 'npc_bailey_broken' : 'npc_bailey'; res.status(200).send({ html: `

${res.t('newStuff')}

7/30/2020 - ${LAST_ANNOUNCEMENT_TITLE}


Summer Splash is coming to a close in Habitica on July 31, so be sure to snag this year's limited edition outfits from your Rewards column. Depending on your class, you can be an Oarfish Mage, Crocodile Rogue, Rainbow Trout Warrior, or Sea Glass Healer. Don't miss these awesome gear sets, available to purchase with Gold for now!

by jjgame83, QuartzFox, Vyllan, Vikte, and SabreCat

The Seasonal Shop will also close when the Gala ends. The Seasonal Sorceress is stocking the seasonal edition versions of previous summer outfits, now available for Gems instead of Gold, and Seafoam.

by SabreCat, Lemoness, AnnDeLune, Vikte, gawrone, TheDudeAbides, Lalaitha, Beffymaroo, Vampitch, nonight, tricksy.fox, Giu09, JaizakArpaik, TetoForever, and Kai

Watery, Aquatic, and Sand Sculpture Magic Hatching Potions are also leaving the Market on July 31. If they come back, it won't be until next year at the earliest, so don't delay!

by Shine Caramia, a_diamond, Persephone, Stefalupagus, Beffymaroo and SabreCat

Don't miss the Splashy Skins! They're also available in User > Customize Avatar until the Gala ends. But once you purchase them, you can use them year-round!

by Lemoness and UncommonCriminal

Last Chance for Outstanding Orca Set

You have until July 31 to subscribe and receive the Outstanding Orca Set! Subscribing also lets you buy Gems with Gold. The longer your subscription, the more Gems you can get!

Thanks so much for your support! You help keep Habitica running ad-free.

by Beffymaroo

Last Chance for Aquatic Amigos Pet Quest Bundle

Lastly, don't forget the discounted Aquatic Amigos Pet Quest Bundle, featuring the Axolotl, Cuttlefish, and Octopus quests all for seven Gems! Be sure to snag it from the Quest Shop before it splashes out of sight when the Gala closes.

by PainterProphet, Streak, James Danger, hazel, RiverMori, UncommonCriminal, Urse, RBrinks, TokenKnight, wolvenhalo, Lemoness, and SabreCat
`, }); }, }; /** * @api {post} /api/v3/news/tell-me-later Allow latest Bailey announcement to be read later * @apiName TellMeLaterNews * @apiDescription Add a notification to allow viewing of the latest "New Stuff by Bailey" message. * Prevent this specific Bailey message from appearing automatically. * @apiGroup News * * * @apiSuccess {Object} data An empty Object * */ api.tellMeLaterNews = { method: 'POST', middlewares: [authWithHeaders()], url: '/news/tell-me-later', async handler (req, res) { const { user } = res.locals; user.flags.newStuff = false; const existingNotificationIndex = user.notifications.findIndex(n => n && n.type === 'NEW_STUFF'); if (existingNotificationIndex !== -1) user.notifications.splice(existingNotificationIndex, 1); user.addNotification('NEW_STUFF', { title: LAST_ANNOUNCEMENT_TITLE }, true); // seen by default await user.save(); res.respond(200, {}); }, }; export default api;