revert commits accidentally added from "Added support for grouping tasks by challenge"

So sorry, but I accidentally pushed some commits I'd been testing. :( This reverts them.

Reverts c496f94c79 ad6073220d d669db0f9a c244fe488d
This commit is contained in:
Alys
2017-02-12 12:17:23 +10:00
parent 20e8f47def
commit af047d3c82
11 changed files with 9 additions and 34 deletions

View File

@@ -117,9 +117,7 @@ describe('POST /challenges/:challengeId/leave', () => {
});
expect(testTask).to.not.be.undefined;
expect(testTask.challenge).to.eql({
name: 'None',
});
expect(testTask.challenge).to.eql({});
});
});
});

View File

@@ -84,7 +84,7 @@ describe('GET /groups/:groupId/members', () => {
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql([
'size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background', 'tasks',
'chair', 'costume', 'sleep', 'background',
].sort());
expect(memberRes.stats.maxMP).to.exist;

View File

@@ -37,7 +37,7 @@ describe('GET /members/:memberId', () => {
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql([
'size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background', 'tasks',
'chair', 'costume', 'sleep', 'background',
].sort());
expect(memberRes.stats.maxMP).to.exist;

View File

@@ -139,6 +139,5 @@
"taskRequiresApproval": "This task must be approved before you can complete it. Approval has already been requested",
"taskApprovalHasBeenRequested": "Approval has been requested",
"approvals": "Approvals",
"approvalRequired": "Approval Required",
"groupTasksByChallenge": "Group tasks by challenge title"
"approvalRequired": "Approval Required"
}

View File

@@ -121,7 +121,7 @@ schema.methods.syncToUser = async function syncChallengeToUser (user) {
if (!matchingTask) { // If the task is new, create it
matchingTask = new Tasks[chalTask.type](Tasks.Task.sanitize(syncableAttrs(chalTask)));
matchingTask.challenge = {taskId: chalTask._id, id: challenge._id, name: challenge.shortName};
matchingTask.challenge = {taskId: chalTask._id, id: challenge._id};
matchingTask.userId = user._id;
user.tasksOrder[`${chalTask.type}s`].push(matchingTask._id);
} else {

View File

@@ -58,7 +58,6 @@ export let TaskSchema = new Schema({
userId: {type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']}, // When not set it belongs to a challenge
challenge: {
name: {type: String, default: 'None'},
id: {type: String, ref: 'Challenge', validate: [validator.isUUID, 'Invalid uuid.']}, // When set (and userId not set) it's the original task
taskId: {type: String, ref: 'Task', validate: [validator.isUUID, 'Invalid uuid.']}, // When not set but challenge.id defined it's the original task
broken: {type: String, enum: ['CHALLENGE_DELETED', 'TASK_DELETED', 'UNSUBSCRIBED', 'CHALLENGE_CLOSED', 'CHALLENGE_TASK_NOT_FOUND']}, // CHALLENGE_TASK_NOT_FOUND comes from v3 migration

View File

@@ -7,7 +7,7 @@ require('./methods');
// A list of publicly accessible fields (not everything from preferences because there are also a lot of settings tha should remain private)
export let publicFields = `preferences.size preferences.hair preferences.skin preferences.shirt
preferences.chair preferences.costume preferences.sleep preferences.background preferences.tasks profile stats
preferences.chair preferences.costume preferences.sleep preferences.background profile stats
achievements party backer contributor auth.timestamps items inbox.optOut`;
// The minimum amount of data needed when populating multiple users

View File

@@ -465,9 +465,6 @@ let schema = new Schema({
raisePet: {type: Boolean, default: false},
streak: {type: Boolean, default: false},
},
tasks: {
groupByChallenge: {type: Boolean, default: false},
},
improvementCategories: {
type: Array,
validate: (categories) => {

View File

@@ -88,10 +88,6 @@ script(type='text/ng-template', id='partials/options.settings.settings.html')
label=env.t('suppressStreakModal')
input(type='checkbox', ng-model='user.preferences.suppressModals.streak', ng-change='set({"preferences.suppressModals.streak": user.preferences.suppressModals.streak?true: false})')
.checkbox
label=env.t('groupTasksByChallenge')
input(type='checkbox', ng-model='user.preferences.tasks.groupByChallenge', ng-change='set({"preferences.tasks.groupByChallenge": user.preferences.tasks.groupByChallenge ? true: false})')
hr
button.btn.btn-default(ng-click='showBailey()', popover-trigger='mouseenter', popover-placement='right', popover=env.t('showBaileyPop'))= env.t('showBailey')

View File

@@ -6,10 +6,7 @@ include ./task_view/mixins
script(id='templates/habitrpg-tasks.html', type="text/ng-template")
.tasks-lists.container-fluid
.row
.col-sm-6.col-md-3(
ng-repeat='list in lists',
ng-init="groupedList = _.groupBy(obj[list.type + 's'], 'challenge.name')",
ng-class='::{ "rewards-module": list.type==="reward", "new-row-sm": list.type==="todo" }')
.col-sm-6.col-md-3(ng-repeat='list in lists', ng-class='::{ "rewards-module": list.type==="reward", "new-row-sm": list.type==="todo" }')
.task-column(class='{{::list.type}}s')
include ./task_view/graph
@@ -32,19 +29,8 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
+taskColumnTabs('top')
// Actual List
ul(class='{{::list.type}}s main-list',
ng-init='taskList = obj[list.type+"s"]',
ng-show='obj[list.type + "s"].length > 0',
hrpg-sort-tasks, ng-if='!$state.includes("options.social.challenges") && !user.preferences.tasks.groupByChallenge')
ul(class='{{::list.type}}s main-list', ng-show='obj[list.type + "s"].length > 0', hrpg-sort-tasks, ng-if='!$state.includes("options.social.challenges")')
include ./task
div(ng-repeat="(key, taskList) in groupedList", ng-if='user.preferences.tasks.groupByChallenge')
h3 {{key}}
ul(class='{{::list.type}}s main-list',
ng-show='taskList.length > 0', hrpg-sort-tasks,
ng-if='!$state.includes("options.social.challenges")')
include ./task
//Loads the non-sortable lists for challenges
ul(class='{{::list.type}}s main-list', ng-show='obj[list.type + "s"].length > 0', ng-if='$state.includes("options.social.challenges")')
include ./task

View File

@@ -1,5 +1,5 @@
li(id='task-{{::task._id}}',
ng-repeat='task in taskList | filterByTaskInfo: obj.filterQuery | conditionalOrderBy: list.view=="dated":"date"',
ng-repeat='task in obj[list.type+"s"] | filterByTaskInfo: obj.filterQuery | conditionalOrderBy: list.view=="dated":"date"',
class='task {{Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}',
ng-class='{"cast-target":spell && (list.type != "reward"), "locked-task":obj._locked === true}',
ng-click='spell && (list.type != "reward") && castEnd(task, "task", $event)',