mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Merge branch 'develop' of https://github.com/HabitRPG/habitica into negue/flagpm
# Conflicts: # website/client/store/actions/chat.js
This commit is contained in:
@@ -196,6 +196,7 @@ api.createGroupPlan = {
|
||||
|
||||
// @TODO: Change message
|
||||
if (group.privacy !== 'private') throw new NotAuthorized(res.t('partyMustbePrivate'));
|
||||
group.memberCount = await User.count({ $or: [{ 'party._id': group._id }, { guilds: group._id }] }).exec();
|
||||
group.leader = user._id;
|
||||
user.guilds.push(group._id);
|
||||
|
||||
@@ -664,14 +665,14 @@ api.joinGroup = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/groups/:groupId/reject Reject a group invitation
|
||||
* @api {post} /api/v3/groups/:groupId/reject-invite Reject a group invitation
|
||||
* @apiName RejectGroupInvite
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
*
|
||||
* @apiParamExample {String} party:
|
||||
* /api/v3/groups/party/reject
|
||||
* /api/v3/groups/party/reject-invite
|
||||
*
|
||||
* @apiSuccess {Object} data An empty object
|
||||
*
|
||||
|
||||
@@ -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 = 'JUNE 2018 RESOLUTION SUCCESS CHALLENGE AND TAKE THIS CHALLENGE';
|
||||
const LAST_ANNOUNCEMENT_TITLE = 'USE CASE SPOTLIGHT AND GUILD SPOTLIGHT ON PARENTING AND FAMILY LIFE, PLUS NEW BEHIND THE SCENES POST!';
|
||||
const worldDmg = { // @TODO
|
||||
bailey: false,
|
||||
};
|
||||
@@ -30,26 +30,24 @@ api.getNews = {
|
||||
<div class="align-self-center mr-3 ${baileyClass}"></div>
|
||||
<div class="media-body">
|
||||
<h1 class="align-self-center">${res.t('newStuff')}</h1>
|
||||
<h2>6/22/2018 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<h2>6/1/2018 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
|
||||
<hr/>
|
||||
<div class="media">
|
||||
<div class="media align-items-center">
|
||||
<div class="media-body">
|
||||
<p>The Habitica team has launched a special official Challenge series hosted in the <a href='/groups/guild/6e6a8bd3-9f5f-4351-9188-9f11fcd80a99' target='_blank'>Official New Year's Resolution Guild</a>. These Challenges are designed to help you build and maintain goals that are destined for success and then stick with them as the year progresses. For this month's Challenge, <a href='/challenges/07f492bc-3d0a-460e-a525-165dd219a91d' target='_blank'>Mark Your Journey</a>, we're reflecting on your achievements since January and looking ahead to the rest of the year! It has a 15 Gem prize, which will be awarded to five lucky winners on July 2nd.</p>
|
||||
<p>Congratulations to the winners of the May Challenge, RubberSoul, Carolee, MyNameIsNotRyn, Rapunculus IV, and notunremarkable!</p>
|
||||
<p>We've got new posts on the blog all about ways to use Habitica to help with parenting and family-related matters! First, there's a <a href='https://habitica.wordpress.com/2018/06/14/guilds-for-parenting-and-family-life/' target='_blank'>Guild Spotlight</a> that highlights the Guilds that can help you as you explore ways to use Habitica to smooth your home and family life. We've also posted a <a href='https://habitica.wordpress.com/2018/06/14/use-case-spotlight-parenting-and-family-life/' target='blank'>Use Case Spotlight</a> featuring a number of great suggestions for using Habitica's task system to manage parenting and family-related tasks! These suggestions were submitted by Habiticans in the <a href='/groups/guild/1d3a10bf-60aa-4806-a38b-82d1084a59e6' target='_blank'>Use Case Spotlights Guild</a>.</p>
|
||||
</div>
|
||||
<div class="scene_hiking ml-3"></div>
|
||||
<div class="scene_families ml-3 mb-3"></div>
|
||||
</div>
|
||||
<p>The next Take This Challenge has also launched, <a href='/challenges/f0481f95-1dde-4ae7-a876-d19502a45d61' target='_blank'>Hero's Triumph!</a>, with a focus on volunteer efforts. Be sure to check it out to earn additional pieces of the Take This armor set!</p>
|
||||
<div class="media">
|
||||
<div class="promo_take_this mr-3 mb-3"></div>
|
||||
<div class="media align-items-center">
|
||||
<div class="scene_moderators mr-3 mb-3"></div>
|
||||
<div class="media-body">
|
||||
<p><a href='http://www.takethis.org/' target='_blank'>Take This</a> is a nonprofit that seeks to inform the gamer community about mental health issues, to provide education about mental disorders and mental illness prevention, and to reduce the stigma of mental illness.</p>
|
||||
<p>Plus, we're collecting user submissions for the next Use Case Spotlight! How do you use Habitica to build a routine to challenge your brain and keep your mind sharp? We’ll be featuring player-submitted examples in Use Case Spotlights on the Habitica Blog next month, so post your suggestions in the Use Case Spotlight Guild now. We look forward to learning more about how you use Habitica to improve your life and get things done!</p>
|
||||
<p>There's also a new <a href='https://habitica.wordpress.com/2018/06/21/behind-the-scenes-weird-tales-of-the-mod-slack/' target='_blank'>Behind the Scenes post</a> on the Habitica blog about fun facts and goofy shenanigans from the Moderator Team and their behind-the-scenes chat channel. Check it out!</p>
|
||||
<div class="small mb-3">by Beffymaroo, the Habitica Staff, and the Moderator Team</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>Congratulations to the winners of the last Take This Challenge, "Keep Calm and Carry On!": grand prize winner Betsy, and runners-up Caiwan (Sári Péter), tebrilas, Christopher, eeyoregirl, and Serenity. Plus, all participants in that Challenge have received a piece of the <a href='http://habitica.wikia.com/wiki/Event_Item_Sequences#Take_This_Armor_Set' target='_blank'>Take This item set</a> if they hadn't collected all the pieces already. It is located in your Rewards column. Enjoy!</p>
|
||||
<div class="small mb-3">by Doctor B, the Take This team, Lemoness, Beffymaroo, and SabreCat</div>
|
||||
</div>
|
||||
`,
|
||||
});
|
||||
|
||||
@@ -25,8 +25,6 @@ import logger from '../../libs/logger';
|
||||
import moment from 'moment';
|
||||
import apiError from '../../libs/apiError';
|
||||
|
||||
const MAX_SCORE_NOTES_LENGTH = 256;
|
||||
|
||||
function canNotEditTasks (group, user, assignedUserId) {
|
||||
let isNotGroupLeader = group.leader !== user._id;
|
||||
let isManager = Boolean(group.managers[user._id]);
|
||||
@@ -530,7 +528,6 @@ api.updateTask = {
|
||||
*
|
||||
* @apiParam (Path) {String} taskId The task _id or alias
|
||||
* @apiParam (Path) {String="up","down"} direction The direction for scoring the task
|
||||
* @apiParam (Body) {String} scoreNotes Notes explaining the scoring
|
||||
*
|
||||
* @apiExample {json} Example call:
|
||||
* curl -X "POST" https://habitica.com/api/v3/tasks/test-api-params/score/up
|
||||
@@ -556,18 +553,14 @@ api.scoreTask = {
|
||||
async handler (req, res) {
|
||||
req.checkParams('direction', res.t('directionUpDown')).notEmpty().isIn(['up', 'down']);
|
||||
|
||||
let validationErrors = req.validationErrors();
|
||||
const validationErrors = req.validationErrors();
|
||||
if (validationErrors) throw validationErrors;
|
||||
|
||||
let user = res.locals.user;
|
||||
let scoreNotes = req.body.scoreNotes;
|
||||
if (scoreNotes && scoreNotes.length > MAX_SCORE_NOTES_LENGTH) throw new NotAuthorized(res.t('taskScoreNotesTooLong'));
|
||||
let {taskId} = req.params;
|
||||
const user = res.locals.user;
|
||||
const {taskId} = req.params;
|
||||
|
||||
let task = await Tasks.Task.findByIdOrAlias(taskId, user._id, {userId: user._id});
|
||||
let direction = req.params.direction;
|
||||
|
||||
if (scoreNotes) task.scoreNotes = scoreNotes;
|
||||
const task = await Tasks.Task.findByIdOrAlias(taskId, user._id, {userId: user._id});
|
||||
const direction = req.params.direction;
|
||||
|
||||
if (!task) throw new NotFound(res.t('taskNotFound'));
|
||||
|
||||
@@ -679,13 +672,13 @@ api.scoreTask = {
|
||||
if (task.challenge && task.challenge.id && task.challenge.taskId && !task.challenge.broken && task.type !== 'reward') {
|
||||
// Wrapping everything in a try/catch block because if an error occurs using `await` it MUST NOT bubble up because the request has already been handled
|
||||
try {
|
||||
let chalTask = await Tasks.Task.findOne({
|
||||
const chalTask = await Tasks.Task.findOne({
|
||||
_id: task.challenge.taskId,
|
||||
}).exec();
|
||||
|
||||
if (!chalTask) return;
|
||||
|
||||
await chalTask.scoreChallengeTask(delta);
|
||||
await chalTask.scoreChallengeTask(delta, direction);
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user