Merge branch 'develop' into payments/paypal-amazon-checkout

This commit is contained in:
Matteo Pagliazzi
2018-11-29 10:55:13 +01:00
223 changed files with 18960 additions and 18157 deletions
+28 -1
View File
@@ -83,6 +83,8 @@ function getBannedWordsFromText (message) {
return getMatchesByWordArray(message, bannedWords);
}
const mentionRegex = new RegExp('\\B@[-\\w]+', 'g');
/**
* @api {post} /api/v3/groups/:groupId/chat Post chat message to a group
* @apiName PostChat
@@ -175,7 +177,11 @@ api.postChat = {
throw new NotAuthorized(res.t('messageGroupChatSpam'));
}
const newChatMessage = group.sendChat(req.body.message, user);
let client = req.headers['x-client'] || '3rd Party';
if (client) {
client = client.replace('habitica-', '');
}
const newChatMessage = group.sendChat(req.body.message, user, null, client);
let toSave = [newChatMessage.save()];
if (group.type === 'party') {
@@ -185,6 +191,27 @@ api.postChat = {
await Promise.all(toSave);
let analyticsObject = {
uuid: user._id,
hitType: 'event',
category: 'behavior',
groupType: group.type,
privacy: group.privacy,
headers: req.headers,
};
const mentions = req.body.message.match(mentionRegex);
if (mentions) {
analyticsObject.mentionsCount = mentions.length;
} else {
analyticsObject.mentionsCount = 0;
}
if (group.privacy === 'public') {
analyticsObject.groupName = group.name;
}
res.analytics.track('group chat', analyticsObject);
if (chatUpdated) {
res.respond(200, {chat: chatRes.chat});
} else {
+11 -6
View File
@@ -3,7 +3,7 @@ import { authWithHeaders } from '../../middlewares/auth';
let api = {};
// @TODO export this const, cannot export it from here because only routes are exported from controllers
const LAST_ANNOUNCEMENT_TITLE = 'THUNDERSTORM AND FROST HATCHING POTIONS';
const LAST_ANNOUNCEMENT_TITLE = 'NOVEMBER SUBSCRIBER ITEMS AND STAFF SPOTLIGHT!';
const worldDmg = { // @TODO
bailey: false,
};
@@ -30,14 +30,19 @@ api.getNews = {
<div class="mr-3 ${baileyClass}"></div>
<div class="media-body">
<h1 class="align-self-center">${res.t('newStuff')}</h1>
<h2>11/20/2018 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
<h2>11/28/2018 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
</div>
</div>
<hr/>
<div class="promo_frost_potions center-block"></div>
<p>We've brought back Thunderstorm Potions, and added a brand-new Magic Hatching Potion: Frost! Between now and November 30, you can buy these Hatching Potions from <a href='/shops/market' target='_blank'>the Market</a> and use them to hatch any standard pet egg. (Magic Hatching Potions do not work on Quest Pet eggs.) Magic Hatching Potion Pets aren't picky, so they'll happily eat any kind of food that you feed them!</p>
<p>After they're gone, it will be at least a year before the Thunderstorm or Frost Hatching Potions are available again, so be sure to get them now!</p>
<div class="small mb-3">by Balduranne and SabreCat</div>
<div class="promo_mystery_201811 center-block"></div>
<h3>November Subscriber Items Revealed!</h3>
<p>The November Subscriber Items have been revealed: the Splendid Sorcerer Item Set! You'll receive this item set when you <a href='/user/settings/subscription' target='_blank'>subscribe</a> by December 3. If you're already an active subscriber, reload the site and then head to Inventory > Items to claim your gear!</p>
<p>Subscribers also receive the ability to buy Gems for Gold -- the longer you subscribe, the more Gems you can buy per month! There are other perks as well, such as longer access to uncompressed data and a cute Jackalope pet. Best of all, subscriptions let us keep Habitica running. Thank you very much for your support -- it means a lot to us.</p>
<div class="small mb-3">by Beffymaroo</div>
<div class="promo_piyo center-block"></div>
<h3>Staff Spotlight: Sara, aka Piyo</h3>
<p>There's a new <a href='https://habitica.wordpress.com/2018/11/20/staff-spotlight-sara-aka-piyo/' target='_blank'>Staff Spotlight</a> on the blog! Come meet Sara, aka Piyo, and learn how our favorite onesie-wearing cryptid balances her design work for Habitica with her enthusiasm for baking and video games.</p>
<div class="small mb-3">by Beffymaroo</div>
</div>
`,
});