mirror of
https://github.com/wekan/wekan.git
synced 2026-02-10 02:04:20 +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
|
|
@ -28,9 +28,9 @@ class FixAllFileUrlsMigration {
|
|||
if (!board || !board.members) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const memberIds = board.members.map(m => m.userId);
|
||||
|
||||
|
||||
// Check for problematic avatar URLs for board members
|
||||
const users = ReactiveCache.getUsers({ _id: { $in: memberIds } });
|
||||
for (const user of users) {
|
||||
|
|
@ -46,7 +46,7 @@ class FixAllFileUrlsMigration {
|
|||
const cards = ReactiveCache.getCards({ boardId });
|
||||
const cardIds = cards.map(c => c._id);
|
||||
const attachments = ReactiveCache.getAttachments({ cardId: { $in: cardIds } });
|
||||
|
||||
|
||||
for (const attachment of attachments) {
|
||||
if (attachment.url && this.hasProblematicUrl(attachment.url)) {
|
||||
return true;
|
||||
|
|
@ -61,17 +61,17 @@ class FixAllFileUrlsMigration {
|
|||
*/
|
||||
hasProblematicUrl(url) {
|
||||
if (!url) return false;
|
||||
|
||||
|
||||
// Check for auth parameters
|
||||
if (url.includes('auth=false') || url.includes('brokenIsFine=true')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Check for absolute URLs with domains
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Check for ROOT_URL dependencies
|
||||
if (Meteor.isServer && process.env.ROOT_URL) {
|
||||
try {
|
||||
|
|
@ -83,12 +83,12 @@ class FixAllFileUrlsMigration {
|
|||
// Ignore URL parsing errors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for non-universal file URLs
|
||||
if (url.includes('/cfs/files/') && !isUniversalFileUrl(url, 'attachment') && !isUniversalFileUrl(url, 'avatar')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class FixAllFileUrlsMigration {
|
|||
}
|
||||
|
||||
console.log(`Universal file URL migration completed for board ${boardId}. Fixed ${filesFixed} file URLs.`);
|
||||
|
||||
|
||||
return {
|
||||
success: errors.length === 0,
|
||||
filesFixed,
|
||||
|
|
@ -137,7 +137,7 @@ class FixAllFileUrlsMigration {
|
|||
if (!board || !board.members) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const memberIds = board.members.map(m => m.userId);
|
||||
const users = ReactiveCache.getUsers({ _id: { $in: memberIds } });
|
||||
let avatarsFixed = 0;
|
||||
|
|
@ -145,12 +145,12 @@ class FixAllFileUrlsMigration {
|
|||
for (const user of users) {
|
||||
if (user.profile && user.profile.avatarUrl) {
|
||||
const avatarUrl = user.profile.avatarUrl;
|
||||
|
||||
|
||||
if (this.hasProblematicUrl(avatarUrl)) {
|
||||
try {
|
||||
// Extract file ID from URL
|
||||
const fileId = extractFileIdFromUrl(avatarUrl, 'avatar');
|
||||
|
||||
|
||||
let cleanUrl;
|
||||
if (fileId) {
|
||||
// Generate universal URL
|
||||
|
|
@ -159,7 +159,7 @@ class FixAllFileUrlsMigration {
|
|||
// Clean existing URL
|
||||
cleanUrl = cleanFileUrl(avatarUrl, 'avatar');
|
||||
}
|
||||
|
||||
|
||||
if (cleanUrl && cleanUrl !== avatarUrl) {
|
||||
// Update user's avatar URL
|
||||
Users.update(user._id, {
|
||||
|
|
@ -168,9 +168,9 @@ class FixAllFileUrlsMigration {
|
|||
modifiedAt: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
avatarsFixed++;
|
||||
|
||||
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(`Fixed avatar URL for user ${user.username}: ${avatarUrl} -> ${cleanUrl}`);
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ class FixAllFileUrlsMigration {
|
|||
try {
|
||||
const fileId = attachment._id;
|
||||
const cleanUrl = generateUniversalAttachmentUrl(fileId);
|
||||
|
||||
|
||||
if (cleanUrl && cleanUrl !== attachment.url) {
|
||||
// Update attachment URL
|
||||
Attachments.update(attachment._id, {
|
||||
|
|
@ -209,9 +209,9 @@ class FixAllFileUrlsMigration {
|
|||
modifiedAt: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
attachmentsFixed++;
|
||||
|
||||
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(`Fixed attachment URL: ${attachment.url} -> ${cleanUrl}`);
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ class FixAllFileUrlsMigration {
|
|||
try {
|
||||
const fileId = attachment._id || extractFileIdFromUrl(attachment.url, 'attachment');
|
||||
const cleanUrl = fileId ? generateUniversalAttachmentUrl(fileId) : cleanFileUrl(attachment.url, 'attachment');
|
||||
|
||||
|
||||
if (cleanUrl && cleanUrl !== attachment.url) {
|
||||
// Update attachment with fixed URL
|
||||
Attachments.update(attachment._id, {
|
||||
|
|
@ -248,9 +248,9 @@ class FixAllFileUrlsMigration {
|
|||
modifiedAt: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
attachmentsFixed++;
|
||||
|
||||
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(`Fixed attachment URL ${attachment._id}`);
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ export const fixAllFileUrlsMigration = new FixAllFileUrlsMigration();
|
|||
Meteor.methods({
|
||||
'fixAllFileUrls.execute'(boardId) {
|
||||
check(boardId, String);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'You must be logged in');
|
||||
}
|
||||
|
|
@ -296,17 +296,17 @@ Meteor.methods({
|
|||
if (!isBoardAdmin && !user.isAdmin) {
|
||||
throw new Meteor.Error('not-authorized', 'Only board administrators can run migrations');
|
||||
}
|
||||
|
||||
|
||||
return fixAllFileUrlsMigration.execute(boardId);
|
||||
},
|
||||
|
||||
'fixAllFileUrls.needsMigration'(boardId) {
|
||||
check(boardId, String);
|
||||
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized', 'You must be logged in');
|
||||
}
|
||||
|
||||
|
||||
return fixAllFileUrlsMigration.needsMigration(boardId);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue