summaryrefslogtreecommitdiffstats
path: root/models/cards.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-08-13 11:45:30 +0300
committerLauri Ojansivu <x@xet7.org>2019-08-13 11:45:30 +0300
commitee0fb094e6a754809b3b465eb0ef2da9d48a510b (patch)
treed4008529b656b1a91002a7aa629039f54269f55f /models/cards.js
parent306301e881b2637750b1aa3ff66a0d90a9568474 (diff)
downloadwekan-ee0fb094e6a754809b3b465eb0ef2da9d48a510b.tar.gz
wekan-ee0fb094e6a754809b3b465eb0ef2da9d48a510b.tar.bz2
wekan-ee0fb094e6a754809b3b465eb0ef2da9d48a510b.zip
Revert In-Progress Assignee field, moving it to feature branch.
Thanks to xet7 ! Fixes #2612
Diffstat (limited to 'models/cards.js')
-rw-r--r--models/cards.js162
1 files changed, 0 insertions, 162 deletions
diff --git a/models/cards.js b/models/cards.js
index 121d4a0f..d92d003c 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -201,14 +201,6 @@ Cards.attachSchema(
optional: true,
defaultValue: [],
},
- assignees: {
- /**
- * list of assignees (user IDs) who are responsible for completing card
- */
- type: [String],
- optional: true,
- defaultValue: [],
- },
receivedAt: {
/**
* Date the card was received
@@ -417,10 +409,6 @@ Cards.helpers({
return _.contains(this.getMembers(), memberId);
},
- isAssignee(assigneeId) {
- return _.contains(this.getAssignee(), assigneeId);
- },
-
activities() {
if (this.isLinkedCard()) {
return Activities.find(
@@ -755,20 +743,6 @@ Cards.helpers({
}
},
- getAssignees() {
- if (this.isLinkedCard()) {
- const card = Cards.findOne({ _id: this.linkedId });
- return card.assignees;
- } else if (this.isLinkedBoard()) {
- const board = Boards.findOne({ _id: this.linkedId });
- return board.activeAssignees().map(assignee => {
- return assignee.userId;
- });
- } else {
- return this.assignees;
- }
- },
-
assignMember(memberId) {
if (this.isLinkedCard()) {
return Cards.update(
@@ -786,23 +760,6 @@ Cards.helpers({
}
},
- assignAssignee(assigneeId) {
- if (this.isLinkedCard()) {
- return Cards.update(
- { _id: this.linkedId },
- { $addToSet: { assignees: assigneeId } },
- );
- } else if (this.isLinkedBoard()) {
- const board = Boards.findOne({ _id: this.linkedId });
- return board.addAssignee(assigneeId);
- } else {
- return Cards.update(
- { _id: this._id },
- { $addToSet: { assignees: assigneeId } },
- );
- }
- },
-
unassignMember(memberId) {
if (this.isLinkedCard()) {
return Cards.update(
@@ -817,23 +774,6 @@ Cards.helpers({
}
},
- unassignAssignee(assigneeId) {
- if (this.isLinkedCard()) {
- return Cards.update(
- { _id: this.linkedId },
- { $pull: { assignees: assigneeId } },
- );
- } else if (this.isLinkedBoard()) {
- const board = Boards.findOne({ _id: this.linkedId });
- return board.removeAssignee(assigneeId);
- } else {
- return Cards.update(
- { _id: this._id },
- { $pull: { assignees: assigneeId } },
- );
- }
- },
-
toggleMember(memberId) {
if (this.getMembers() && this.getMembers().indexOf(memberId) > -1) {
return this.unassignMember(memberId);
@@ -842,14 +782,6 @@ Cards.helpers({
}
},
- toggleAssignee(assigneeId) {
- if (this.getAssignees() && this.getAssignees().indexOf(assigneeId) > -1) {
- return this.unassignAssignee(assigneeId);
- } else {
- return this.assignAssignee(assigneeId);
- }
- },
-
getReceived() {
if (this.isLinkedCard()) {
const card = Cards.findOne({ _id: this.linkedId });
@@ -1192,14 +1124,6 @@ Cards.mutations({
};
},
- assignAssignee(assigneeId) {
- return {
- $addToSet: {
- assignees: assigneeId,
- },
- };
- },
-
unassignMember(memberId) {
return {
$pull: {
@@ -1208,14 +1132,6 @@ Cards.mutations({
};
},
- unassignAssignee(assigneeId) {
- return {
- $pull: {
- assignee: assigneeId,
- },
- };
- },
-
toggleMember(memberId) {
if (this.members && this.members.indexOf(memberId) > -1) {
return this.unassignMember(memberId);
@@ -1224,14 +1140,6 @@ Cards.mutations({
}
},
- toggleAssignee(assigneeId) {
- if (this.assignees && this.assignees.indexOf(assigneeId) > -1) {
- return this.unassignAssignee(assigneeId);
- } else {
- return this.assignAssignee(assigneeId);
- }
- },
-
assignCustomField(customFieldId) {
return {
$addToSet: {
@@ -1506,28 +1414,6 @@ function cardMembers(userId, doc, fieldNames, modifier) {
}
}
- function cardAssignees(userId, doc, fieldNames, modifier) {
- if (!_.contains(fieldNames, 'assignees')) return;
- let assigneeId;
- // Say hello to the new assignee
- if (modifier.$addToSet && modifier.$addToSet.assignees) {
- assigneeId = modifier.$addToSet.assignees;
- const username = Users.findOne(assigneeId).username;
- if (!_.contains(doc.assignees, assigneeId)) {
- Activities.insert({
- userId,
- username,
- activityType: 'joinAssignee',
- boardId: doc.boardId,
- cardId: doc._id,
- assigneeId,
- listId: doc.listId,
- swimlaneId: doc.swimlaneId,
- });
- }
- }
- }
-
// Say goodbye to the former member
if (modifier.$pull && modifier.$pull.members) {
memberId = modifier.$pull.members;
@@ -1546,25 +1432,6 @@ function cardMembers(userId, doc, fieldNames, modifier) {
});
}
}
-
- // Say goodbye to the former assignee
- if (modifier.$pull && modifier.$pull.assignees) {
- assigneeId = modifier.$pull.assignees;
- const username = Users.findOne(assigneeId).username;
- // Check that the former assignee is assignee of the card
- if (_.contains(doc.assignees, assigneeId)) {
- Activities.insert({
- userId,
- username,
- activityType: 'unjoinAssignee',
- boardId: doc.boardId,
- cardId: doc._id,
- assigneeId,
- listId: doc.listId,
- swimlaneId: doc.swimlaneId,
- });
- }
- }
}
function cardLabels(userId, doc, fieldNames, modifier) {
@@ -1783,12 +1650,6 @@ if (Meteor.isServer) {
updateActivities(doc, fieldNames, modifier);
});
- // Add a new activity if we add or remove a assignee to the card
- Cards.before.update((userId, doc, fieldNames, modifier) => {
- cardAssignees(userId, doc, fieldNames, modifier);
- updateActivities(doc, fieldNames, modifier);
- });
-
// Add a new activity if we add or remove a label to the card
Cards.before.update((userId, doc, fieldNames, modifier) => {
cardLabels(userId, doc, fieldNames, modifier);
@@ -1948,7 +1809,6 @@ if (Meteor.isServer) {
* @param {string} description the description of the new card
* @param {string} swimlaneId the swimlane ID of the new card
* @param {string} [members] the member IDs list of the new card
- * @param {string} [assignees] the assignee IDs list of the new card
* @return_type {_id: string}
*/
JsonRoutes.add('POST', '/api/boards/:boardId/lists/:listId/cards', function(
@@ -1970,7 +1830,6 @@ if (Meteor.isServer) {
_id: req.body.authorId,
});
const members = req.body.members || [req.body.authorId];
- const assignees = req.body.assignees;
if (typeof check !== 'undefined') {
const id = Cards.direct.insert({
title: req.body.title,
@@ -1982,7 +1841,6 @@ if (Meteor.isServer) {
swimlaneId: req.body.swimlaneId,
sort: currentCards.count(),
members,
- assignees,
});
JsonRoutes.sendResult(res, {
code: 200,
@@ -2034,7 +1892,6 @@ if (Meteor.isServer) {
* @param {string} [labelIds] the new list of label IDs attached to the card
* @param {string} [swimlaneId] the new swimlane ID of the card
* @param {string} [members] the new list of member IDs attached to the card
- * @param {string} [assignees] the new list of assignee IDs attached to the card
* @param {string} [requestedBy] the new requestedBy field of the card
* @param {string} [assignedBy] the new assignedBy field of the card
* @param {string} [receivedAt] the new receivedAt field of the card
@@ -2295,25 +2152,6 @@ if (Meteor.isServer) {
{ $set: { members: newmembers } },
);
}
- if (req.body.hasOwnProperty('assignees')) {
- let newassignees = req.body.assignees;
- if (_.isString(newassignees)) {
- if (newassignees === '') {
- newassignees = null;
- } else {
- newassignees = [newassignees];
- }
- }
- Cards.direct.update(
- {
- _id: paramCardId,
- listId: paramListId,
- boardId: paramBoardId,
- archived: false,
- },
- { $set: { assignees: newassignees } },
- );
- }
if (req.body.hasOwnProperty('swimlaneId')) {
const newParamSwimlaneId = req.body.swimlaneId;
Cards.direct.update(