mirror of
https://github.com/wekan/wekan.git
synced 2026-02-09 17:54:21 +01:00
Reverted New UI Design of WeKan v8.29 and added more fixes and performance improvements.
Thanks to xet7 !
This commit is contained in:
parent
d152d8fc1b
commit
1b8b8d2eef
196 changed files with 17659 additions and 10028 deletions
|
|
@ -155,9 +155,9 @@ UserPositionHistory.helpers({
|
|||
getDescription() {
|
||||
const entityName = this.entityType;
|
||||
const action = this.actionType;
|
||||
|
||||
|
||||
let desc = `${action} ${entityName}`;
|
||||
|
||||
|
||||
if (this.actionType === 'move') {
|
||||
if (this.previousListId && this.newListId && this.previousListId !== this.newListId) {
|
||||
desc += ' to different list';
|
||||
|
|
@ -167,7 +167,7 @@ UserPositionHistory.helpers({
|
|||
desc += ' position';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return desc;
|
||||
},
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ UserPositionHistory.helpers({
|
|||
}
|
||||
|
||||
const userId = this.userId;
|
||||
|
||||
|
||||
switch (this.entityType) {
|
||||
case 'card': {
|
||||
const card = ReactiveCache.getCard(this.entityId);
|
||||
|
|
@ -211,7 +211,7 @@ UserPositionHistory.helpers({
|
|||
const swimlaneId = this.previousSwimlaneId || card.swimlaneId;
|
||||
const listId = this.previousListId || card.listId;
|
||||
const sort = this.previousSort !== undefined ? this.previousSort : card.sort;
|
||||
|
||||
|
||||
Cards.update(card._id, {
|
||||
$set: {
|
||||
boardId,
|
||||
|
|
@ -228,7 +228,7 @@ UserPositionHistory.helpers({
|
|||
if (list) {
|
||||
const sort = this.previousSort !== undefined ? this.previousSort : list.sort;
|
||||
const swimlaneId = this.previousSwimlaneId || list.swimlaneId;
|
||||
|
||||
|
||||
Lists.update(list._id, {
|
||||
$set: {
|
||||
sort,
|
||||
|
|
@ -242,7 +242,7 @@ UserPositionHistory.helpers({
|
|||
const swimlane = ReactiveCache.getSwimlane(this.entityId);
|
||||
if (swimlane) {
|
||||
const sort = this.previousSort !== undefined ? this.previousSort : swimlane.sort;
|
||||
|
||||
|
||||
Swimlanes.update(swimlane._id, {
|
||||
$set: {
|
||||
sort,
|
||||
|
|
@ -255,7 +255,7 @@ UserPositionHistory.helpers({
|
|||
const checklist = ReactiveCache.getChecklist(this.entityId);
|
||||
if (checklist) {
|
||||
const sort = this.previousSort !== undefined ? this.previousSort : checklist.sort;
|
||||
|
||||
|
||||
Checklists.update(checklist._id, {
|
||||
$set: {
|
||||
sort,
|
||||
|
|
@ -270,7 +270,7 @@ UserPositionHistory.helpers({
|
|||
if (item) {
|
||||
const sort = this.previousSort !== undefined ? this.previousSort : item.sort;
|
||||
const checklistId = this.previousState?.checklistId || item.checklistId;
|
||||
|
||||
|
||||
ChecklistItems.update(item._id, {
|
||||
$set: {
|
||||
sort,
|
||||
|
|
@ -348,20 +348,20 @@ if (Meteor.isServer) {
|
|||
* Cleanup old history entries (keep last 1000 per user per board)
|
||||
*/
|
||||
UserPositionHistory.cleanup = function() {
|
||||
const users = Meteor.users.find({}).fetch();
|
||||
|
||||
const users = Meteor.users.find({}, { fields: { _id: 1 } }).fetch();
|
||||
|
||||
users.forEach(user => {
|
||||
const boards = Boards.find({ 'members.userId': user._id }).fetch();
|
||||
|
||||
const boards = Boards.find({ 'members.userId': user._id }, { fields: { _id: 1 } }).fetch();
|
||||
|
||||
boards.forEach(board => {
|
||||
const history = UserPositionHistory.find(
|
||||
{ userId: user._id, boardId: board._id, isCheckpoint: { $ne: true } },
|
||||
{ sort: { createdAt: -1 }, limit: 1000 }
|
||||
).fetch();
|
||||
|
||||
|
||||
if (history.length >= 1000) {
|
||||
const oldestToKeep = history[999].createdAt;
|
||||
|
||||
|
||||
// Remove entries older than the 1000th entry (except checkpoints)
|
||||
UserPositionHistory.remove({
|
||||
userId: user._id,
|
||||
|
|
@ -391,11 +391,11 @@ Meteor.methods({
|
|||
'userPositionHistory.createCheckpoint'(boardId, checkpointName) {
|
||||
check(boardId, String);
|
||||
check(checkpointName, String);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'Must be logged in');
|
||||
}
|
||||
|
||||
|
||||
// Create a checkpoint entry
|
||||
return UserPositionHistory.insert({
|
||||
userId: this.userId,
|
||||
|
|
@ -413,27 +413,27 @@ Meteor.methods({
|
|||
|
||||
'userPositionHistory.undo'(historyId) {
|
||||
check(historyId, String);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'Must be logged in');
|
||||
}
|
||||
|
||||
|
||||
const history = UserPositionHistory.findOne({ _id: historyId, userId: this.userId });
|
||||
if (!history) {
|
||||
throw new Meteor.Error('not-found', 'History entry not found');
|
||||
}
|
||||
|
||||
|
||||
return history.undo();
|
||||
},
|
||||
|
||||
'userPositionHistory.getRecent'(boardId, limit = 50) {
|
||||
check(boardId, String);
|
||||
check(limit, Number);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'Must be logged in');
|
||||
}
|
||||
|
||||
|
||||
return UserPositionHistory.find(
|
||||
{ userId: this.userId, boardId },
|
||||
{ sort: { createdAt: -1 }, limit: Math.min(limit, 100) }
|
||||
|
|
@ -442,11 +442,11 @@ Meteor.methods({
|
|||
|
||||
'userPositionHistory.getCheckpoints'(boardId) {
|
||||
check(boardId, String);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'Must be logged in');
|
||||
}
|
||||
|
||||
|
||||
return UserPositionHistory.find(
|
||||
{ userId: this.userId, boardId, isCheckpoint: true },
|
||||
{ sort: { createdAt: -1 } }
|
||||
|
|
@ -455,21 +455,21 @@ Meteor.methods({
|
|||
|
||||
'userPositionHistory.restoreToCheckpoint'(checkpointId) {
|
||||
check(checkpointId, String);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'Must be logged in');
|
||||
}
|
||||
|
||||
const checkpoint = UserPositionHistory.findOne({
|
||||
_id: checkpointId,
|
||||
|
||||
const checkpoint = UserPositionHistory.findOne({
|
||||
_id: checkpointId,
|
||||
userId: this.userId,
|
||||
isCheckpoint: true,
|
||||
});
|
||||
|
||||
|
||||
if (!checkpoint) {
|
||||
throw new Meteor.Error('not-found', 'Checkpoint not found');
|
||||
}
|
||||
|
||||
|
||||
// Find all changes after this checkpoint and undo them in reverse order
|
||||
const changesToUndo = UserPositionHistory.find(
|
||||
{
|
||||
|
|
@ -480,7 +480,7 @@ Meteor.methods({
|
|||
},
|
||||
{ sort: { createdAt: -1 } }
|
||||
).fetch();
|
||||
|
||||
|
||||
let undoneCount = 0;
|
||||
changesToUndo.forEach(change => {
|
||||
try {
|
||||
|
|
@ -492,7 +492,7 @@ Meteor.methods({
|
|||
console.warn('Failed to undo change:', change._id, e);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return { undoneCount, totalChanges: changesToUndo.length };
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue