Merge branch 'develop' of https://github.com/HabitRPG/habitica into negue/flagpm

This commit is contained in:
negue
2019-01-27 18:14:51 +01:00
807 changed files with 41837 additions and 36396 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ import {
import {verifyUsername} from '../../libs/user/validation';
const BASE_URL = nconf.get('BASE_URL');
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL');
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL');
let api = {};
@@ -577,7 +577,7 @@ api.exportChallengeCsv = {
.lean().exec(),
]);
let resArray = members.map(member => [member._id, member.profile.name]);
let resArray = members.map(member => [member._id, member.profile.name, member.auth.local.username]);
let lastUserId;
let index = -1;
@@ -606,7 +606,7 @@ api.exportChallengeCsv = {
let challengeTasks = _.reduce(challenge.tasksOrder.toObject(), (result, array) => {
return result.concat(array);
}, []).sort();
resArray.unshift(['UUID', 'name']);
resArray.unshift(['UUID', 'Display Name', 'Username']);
_.times(challengeTasks.length, () => resArray[0].push('Task', 'Value', 'Notes', 'Streak'));
@@ -281,6 +281,7 @@ api.likeChat = {
*
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg' for tavern are accepted)
* @apiParam (Path) {UUID} chatId The chat message id
* @apiParam (Body) {String} [comment] explain why the message was flagged
*
* @apiSuccess {Object} data The flagged chat message
* @apiSuccess {UUID} data.id The id of the message
+1 -1
View File
@@ -29,7 +29,7 @@ import shared from '../../../common';
import apiError from '../../libs/apiError';
const MAX_EMAIL_INVITES_BY_USER = 200;
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL');
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL');
/**
* @apiDefine GroupBodyInvalid
+5 -11
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 = 'NOVEMBER SUBSCRIBER ITEMS AND STAFF SPOTLIGHT!';
const LAST_ANNOUNCEMENT_TITLE = 'GUILD SPOTLIGHT: NEW AND NOTABLE!';
const worldDmg = { // @TODO
bailey: false,
};
@@ -30,19 +30,13 @@ api.getNews = {
<div class="mr-3 ${baileyClass}"></div>
<div class="media-body">
<h1 class="align-self-center">${res.t('newStuff')}</h1>
<h2>11/28/2018 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
<h2>1/18/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
</div>
</div>
<hr/>
<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 class="scene_hat_guild center-block"></div>
<p>There's a new <a href='https://habitica.wordpress.com/2019/01/17/new-and-notable-guild-spotlight/' target='_blank'>Guild Spotlight on the blog</a> that highlights some of Habitica's new and interesting Guilds! Check it out now and find a new group where you can share your interests and goals!</p>
<div class="small mb-3">by shanaqui</div>
</div>
`,
});
@@ -1,6 +1,6 @@
import { authWithHeaders } from '../../middlewares/auth';
import {
NotFound,
NotificationNotFound,
} from '../../libs/errors';
import {
model as User,
@@ -37,7 +37,7 @@ api.readNotification = {
});
if (index === -1) {
throw new NotFound(res.t('messageNotificationNotFound'));
throw new NotificationNotFound(req.language);
}
user.notifications.splice(index, 1);
@@ -81,7 +81,7 @@ api.readNotifications = {
});
if (index === -1) {
throw new NotFound(res.t('messageNotificationNotFound'));
throw new NotificationNotFound(req.language);
}
user.notifications.splice(index, 1);
@@ -129,7 +129,7 @@ api.seeNotification = {
});
if (!notification) {
throw new NotFound(res.t('messageNotificationNotFound'));
throw new NotificationNotFound(req.language);
}
notification.seen = true;
@@ -179,7 +179,7 @@ api.seeNotifications = {
});
if (!notification) {
throw new NotFound(res.t('messageNotificationNotFound'));
throw new NotificationNotFound(req.language);
}
notification.seen = true;
+5 -6
View File
@@ -245,7 +245,7 @@ api.rejectQuest = {
if (group.quest.members[user._id]) throw new BadRequest(res.t('questAlreadyAccepted'));
if (group.quest.members[user._id] === false) throw new BadRequest(res.t('questAlreadyRejected'));
user.party.quest = Group.cleanQuestProgress();
user.party.quest = Group.cleanQuestUser(user.party.quest.progress);
user.markModified('party.quest');
await user.save();
@@ -376,7 +376,7 @@ api.cancelQuest = {
group.save(),
User.update(
{'party._id': groupId},
{$set: {'party.quest': Group.cleanQuestProgress()}},
Group.cleanQuestParty(),
{multi: true}
).exec(),
]);
@@ -427,9 +427,8 @@ api.abortQuest = {
let memberUpdates = User.update({
'party._id': groupId,
}, {
$set: {'party.quest': Group.cleanQuestProgress()},
}, {multi: true}).exec();
}, Group.cleanQuestParty(),
{multi: true}).exec();
let questLeaderUpdate = User.update({
_id: group.quest.leader,
@@ -484,7 +483,7 @@ api.leaveQuest = {
group.quest.members[user._id] = false;
group.markModified('quest.members');
user.party.quest = Group.cleanQuestProgress();
user.party.quest = Group.cleanQuestUser(user.party.quest.progress);
user.markModified('party.quest');
let [savedGroup] = await Promise.all([
+4 -1
View File
@@ -182,7 +182,10 @@ api.reorderTags = {
return tag.id === req.body.tagId;
});
if (tagIndex === -1) throw new NotFound(res.t('tagNotFound'));
user.tags.splice(req.body.to, 0, user.tags.splice(tagIndex, 1)[0]);
const removedItem = user.tags.splice(tagIndex, 1)[0];
user.tags.splice(req.body.to, 0, removedItem);
await user.save();
res.respond(200, {});
+4 -6
View File
@@ -16,15 +16,14 @@ import {
} from '../../libs/webhook';
import {
getUserInfo,
sendTxn as txnEmail,
sendTxn,
} from '../../libs/email';
import Queue from '../../libs/queue';
import * as inboxLib from '../../libs/inbox';
import * as userLib from '../../libs/user';
import nconf from 'nconf';
import get from 'lodash/get';
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL');
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL');
const DELETE_CONFIRMATION = 'DELETE';
/**
@@ -291,8 +290,9 @@ api.deleteUser = {
await user.remove();
if (feedback) {
txnEmail({email: TECH_ASSISTANCE_EMAIL}, 'admin-feedback', [
sendTxn({email: TECH_ASSISTANCE_EMAIL}, 'admin-feedback', [
{name: 'PROFILE_NAME', content: user.profile.name},
{name: 'USERNAME', content: user.auth.local.username},
{name: 'UUID', content: user._id},
{name: 'EMAIL', content: getUserInfo(user, ['email']).email},
{name: 'FEEDBACK_SOURCE', content: 'from deletion form'},
@@ -300,8 +300,6 @@ api.deleteUser = {
]);
}
if (feedback) Queue.sendMessage({feedback, username: user.profile.name}, user._id);
res.analytics.track('account delete', {
uuid: user._id,
hitType: 'event',