mirror of
https://github.com/wekan/wekan.git
synced 2025-12-30 22:28:49 +01:00
Opened card Checklist menu: Hide finished tasks. Show Checklist at Minicard.
Thanks to C0rn3j and xet7 ! Fixes #6019, fixes #5567, fixes #2984
This commit is contained in:
parent
cf62807ad5
commit
fbfde81bc8
13 changed files with 312 additions and 161 deletions
|
|
@ -570,6 +570,14 @@ Boards.attachSchema(
|
|||
defaultValue: false,
|
||||
},
|
||||
|
||||
allowsChecklistAtMinicard: {
|
||||
/**
|
||||
* Does the board allow showing checklists on all minicards?
|
||||
*/
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
|
||||
allowsReceivedDate: {
|
||||
/**
|
||||
* Does the board allows received date?
|
||||
|
|
@ -1578,6 +1586,10 @@ Boards.mutations({
|
|||
return { $set: { allowsShowListsOnMinicard } };
|
||||
},
|
||||
|
||||
setAllowsChecklistAtMinicard(allowsChecklistAtMinicard) {
|
||||
return { $set: { allowsChecklistAtMinicard } };
|
||||
},
|
||||
|
||||
setAllowsRequestedBy(allowsRequestedBy) {
|
||||
return { $set: { allowsRequestedBy } };
|
||||
},
|
||||
|
|
|
|||
|
|
@ -497,13 +497,6 @@ Cards.attachSchema(
|
|||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
hideFinishedChecklistIfItemsAreHidden: {
|
||||
/**
|
||||
* hide completed checklist?
|
||||
*/
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
showListOnMinicard: {
|
||||
/**
|
||||
* show list name on minicard?
|
||||
|
|
@ -512,6 +505,14 @@ Cards.attachSchema(
|
|||
optional: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
showChecklistAtMinicard: {
|
||||
/**
|
||||
* show checklist on minicard?
|
||||
*/
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
@ -2297,10 +2298,10 @@ Cards.mutations({
|
|||
};
|
||||
},
|
||||
|
||||
toggleHideFinishedChecklist() {
|
||||
toggleShowChecklistAtMinicard() {
|
||||
return {
|
||||
$set: {
|
||||
hideFinishedChecklistIfItemsAreHidden: !this.hideFinishedChecklistIfItemsAreHidden,
|
||||
showChecklistAtMinicard: !this.showChecklistAtMinicard,
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
|
|||
|
|
@ -77,6 +77,13 @@ Checklists.attachSchema(
|
|||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
showChecklistAtMinicard: {
|
||||
/**
|
||||
* show this checklist on minicard?
|
||||
*/
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
@ -189,26 +196,9 @@ Checklists.mutations({
|
|||
* @param newCardId move the checklist to this cardId
|
||||
*/
|
||||
move(newCardId) {
|
||||
// update every activity
|
||||
ReactiveCache.getActivities(
|
||||
{checklistId: this._id}
|
||||
).forEach(activity => {
|
||||
Activities.update(activity._id, {
|
||||
$set: {
|
||||
cardId: newCardId,
|
||||
},
|
||||
});
|
||||
});
|
||||
// update every checklist-item
|
||||
ReactiveCache.getChecklistItems(
|
||||
{checklistId: this._id}
|
||||
).forEach(checklistItem => {
|
||||
ChecklistItems.update(checklistItem._id, {
|
||||
$set: {
|
||||
cardId: newCardId,
|
||||
},
|
||||
});
|
||||
});
|
||||
// Note: Activities and ChecklistItems updates are now handled server-side
|
||||
// in the moveChecklist Meteor method to avoid client-side permission issues
|
||||
|
||||
// update the checklist itself
|
||||
return {
|
||||
$set: {
|
||||
|
|
@ -230,9 +220,69 @@ Checklists.mutations({
|
|||
}
|
||||
};
|
||||
},
|
||||
toggleShowChecklistAtMinicard() {
|
||||
return {
|
||||
$set: {
|
||||
showChecklistAtMinicard: !this.showChecklistAtMinicard,
|
||||
}
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Meteor.methods({
|
||||
moveChecklist(checklistId, newCardId) {
|
||||
check(checklistId, String);
|
||||
check(newCardId, String);
|
||||
|
||||
const checklist = ReactiveCache.getChecklist(checklistId);
|
||||
if (!checklist) {
|
||||
throw new Meteor.Error('checklist-not-found', 'Checklist not found');
|
||||
}
|
||||
|
||||
const newCard = ReactiveCache.getCard(newCardId);
|
||||
if (!newCard) {
|
||||
throw new Meteor.Error('card-not-found', 'Target card not found');
|
||||
}
|
||||
|
||||
// Check permissions on both source and target cards
|
||||
const sourceCard = ReactiveCache.getCard(checklist.cardId);
|
||||
if (!allowIsBoardMemberByCard(this.userId, sourceCard)) {
|
||||
throw new Meteor.Error('not-authorized', 'Not authorized to move checklist from source card');
|
||||
}
|
||||
if (!allowIsBoardMemberByCard(this.userId, newCard)) {
|
||||
throw new Meteor.Error('not-authorized', 'Not authorized to move checklist to target card');
|
||||
}
|
||||
|
||||
// Update activities
|
||||
ReactiveCache.getActivities({ checklistId }).forEach(activity => {
|
||||
Activities.update(activity._id, {
|
||||
$set: {
|
||||
cardId: newCardId,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Update checklist items
|
||||
ReactiveCache.getChecklistItems({ checklistId }).forEach(checklistItem => {
|
||||
ChecklistItems.update(checklistItem._id, {
|
||||
$set: {
|
||||
cardId: newCardId,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Update the checklist itself
|
||||
Checklists.update(checklistId, {
|
||||
$set: {
|
||||
cardId: newCardId,
|
||||
},
|
||||
});
|
||||
|
||||
return checklistId;
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.startup(() => {
|
||||
Checklists._collection.createIndex({ modifiedAt: -1 });
|
||||
Checklists._collection.createIndex({ cardId: 1, createdAt: 1 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue