mirror of
https://github.com/wekan/wekan.git
synced 2026-02-09 09:44:22 +01:00
Resolve merge conflicts by accepting PR #6131 changes
Co-authored-by: xet7 <15545+xet7@users.noreply.github.com>
This commit is contained in:
parent
dc0b68ee80
commit
97dd5d2064
257 changed files with 9483 additions and 14103 deletions
101
models/users.js
101
models/users.js
|
|
@ -615,15 +615,6 @@ Users.attachSchema(
|
|||
allowedValues: ['YYYY-MM-DD', 'DD-MM-YYYY', 'MM-DD-YYYY'],
|
||||
defaultValue: 'YYYY-MM-DD',
|
||||
},
|
||||
'profile.zoomLevel': {
|
||||
/**
|
||||
* User-specified zoom level for board view (1.0 = 100%, 1.5 = 150%, etc.)
|
||||
*/
|
||||
type: Number,
|
||||
defaultValue: 1.0,
|
||||
min: 0.5,
|
||||
max: 3.0,
|
||||
},
|
||||
'profile.mobileMode': {
|
||||
/**
|
||||
* User-specified mobile/desktop mode toggle
|
||||
|
|
@ -842,7 +833,6 @@ Users.safeFields = {
|
|||
'profile.fullname': 1,
|
||||
'profile.avatarUrl': 1,
|
||||
'profile.initials': 1,
|
||||
'profile.zoomLevel': 1,
|
||||
'profile.mobileMode': 1,
|
||||
'profile.GreyIcons': 1,
|
||||
orgs: 1,
|
||||
|
|
@ -1103,7 +1093,7 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.getSwimlaneHeight(boardId, swimlaneId);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, get from localStorage
|
||||
try {
|
||||
const stored = localStorage.getItem('wekan-swimlane-heights');
|
||||
|
|
@ -1116,7 +1106,7 @@ Users.helpers({
|
|||
} catch (e) {
|
||||
console.warn('Error reading swimlane heights from localStorage:', e);
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
},
|
||||
|
||||
|
|
@ -1125,17 +1115,17 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.setSwimlaneHeight(boardId, swimlaneId, height);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, save to localStorage
|
||||
try {
|
||||
const stored = localStorage.getItem('wekan-swimlane-heights');
|
||||
let heights = stored ? JSON.parse(stored) : {};
|
||||
|
||||
|
||||
if (!heights[boardId]) {
|
||||
heights[boardId] = {};
|
||||
}
|
||||
heights[boardId][swimlaneId] = height;
|
||||
|
||||
|
||||
localStorage.setItem('wekan-swimlane-heights', JSON.stringify(heights));
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
|
@ -1322,7 +1312,7 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.getListWidth(boardId, listId);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, get from validated localStorage
|
||||
if (typeof localStorage !== 'undefined' && typeof getValidatedLocalStorageData === 'function') {
|
||||
try {
|
||||
|
|
@ -1338,7 +1328,7 @@ Users.helpers({
|
|||
console.warn('Error reading list widths from localStorage:', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 270; // Return default width
|
||||
},
|
||||
|
||||
|
|
@ -1347,23 +1337,23 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.setListWidth(boardId, listId, width);
|
||||
}
|
||||
|
||||
|
||||
// Validate width before storing
|
||||
if (!validators.isValidNumber(width, 270, 1000)) {
|
||||
console.warn('Invalid list width:', width);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, save to validated localStorage
|
||||
if (typeof localStorage !== 'undefined' && typeof setValidatedLocalStorageData === 'function') {
|
||||
try {
|
||||
const widths = getValidatedLocalStorageData('wekan-list-widths', validators.listWidths);
|
||||
|
||||
|
||||
if (!widths[boardId]) {
|
||||
widths[boardId] = {};
|
||||
}
|
||||
widths[boardId][listId] = width;
|
||||
|
||||
|
||||
return setValidatedLocalStorageData('wekan-list-widths', widths, validators.listWidths);
|
||||
} catch (e) {
|
||||
console.warn('Error saving list width to localStorage:', e);
|
||||
|
|
@ -1378,7 +1368,7 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.getListConstraint(boardId, listId);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, get from localStorage
|
||||
try {
|
||||
const stored = localStorage.getItem('wekan-list-constraints');
|
||||
|
|
@ -1391,7 +1381,7 @@ Users.helpers({
|
|||
} catch (e) {
|
||||
console.warn('Error reading list constraints from localStorage:', e);
|
||||
}
|
||||
|
||||
|
||||
return 550; // Return default constraint instead of -1
|
||||
},
|
||||
|
||||
|
|
@ -1400,17 +1390,17 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.setListConstraint(boardId, listId, constraint);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, save to localStorage
|
||||
try {
|
||||
const stored = localStorage.getItem('wekan-list-constraints');
|
||||
let constraints = stored ? JSON.parse(stored) : {};
|
||||
|
||||
|
||||
if (!constraints[boardId]) {
|
||||
constraints[boardId] = {};
|
||||
}
|
||||
constraints[boardId][listId] = constraint;
|
||||
|
||||
|
||||
localStorage.setItem('wekan-list-constraints', JSON.stringify(constraints));
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
|
@ -1424,7 +1414,7 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.getSwimlaneHeight(boardId, swimlaneId);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, get from localStorage
|
||||
try {
|
||||
const stored = localStorage.getItem('wekan-swimlane-heights');
|
||||
|
|
@ -1437,7 +1427,7 @@ Users.helpers({
|
|||
} catch (e) {
|
||||
console.warn('Error reading swimlane heights from localStorage:', e);
|
||||
}
|
||||
|
||||
|
||||
return -1; // Return -1 if not found
|
||||
},
|
||||
|
||||
|
|
@ -1446,17 +1436,17 @@ Users.helpers({
|
|||
if (this._id) {
|
||||
return this.setSwimlaneHeight(boardId, swimlaneId, height);
|
||||
}
|
||||
|
||||
|
||||
// For non-logged-in users, save to localStorage
|
||||
try {
|
||||
const stored = localStorage.getItem('wekan-swimlane-heights');
|
||||
let heights = stored ? JSON.parse(stored) : {};
|
||||
|
||||
|
||||
if (!heights[boardId]) {
|
||||
heights[boardId] = {};
|
||||
}
|
||||
heights[boardId][swimlaneId] = height;
|
||||
|
||||
|
||||
localStorage.setItem('wekan-swimlane-heights', JSON.stringify(heights));
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
|
@ -1782,18 +1772,6 @@ Users.helpers({
|
|||
current[boardId][swimlaneId] = !!collapsed;
|
||||
return await Users.updateAsync(this._id, { $set: { 'profile.collapsedSwimlanes': current } });
|
||||
},
|
||||
|
||||
async setZoomLevel(level) {
|
||||
return await Users.updateAsync(this._id, { $set: { 'profile.zoomLevel': level } });
|
||||
},
|
||||
|
||||
async setMobileMode(enabled) {
|
||||
return await Users.updateAsync(this._id, { $set: { 'profile.mobileMode': enabled } });
|
||||
},
|
||||
|
||||
async setCardZoom(level) {
|
||||
return await Users.updateAsync(this._id, { $set: { 'profile.cardZoom': level } });
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
|
|
@ -1914,16 +1892,16 @@ Meteor.methods({
|
|||
if (!user) {
|
||||
throw new Meteor.Error('user-not-found', 'User not found');
|
||||
}
|
||||
|
||||
|
||||
// Check if board is already starred
|
||||
const starredBoards = (user.profile && user.profile.starredBoards) || [];
|
||||
const isStarred = starredBoards.includes(boardId);
|
||||
|
||||
|
||||
// Build update object
|
||||
const updateObject = isStarred
|
||||
const updateObject = isStarred
|
||||
? { $pull: { 'profile.starredBoards': boardId } }
|
||||
: { $addToSet: { 'profile.starredBoards': boardId } };
|
||||
|
||||
|
||||
Users.update(this.userId, updateObject);
|
||||
},
|
||||
toggleGreyIcons(value) {
|
||||
|
|
@ -1991,11 +1969,11 @@ Meteor.methods({
|
|||
check(boardId, String);
|
||||
check(spaceId, String);
|
||||
if (!this.userId) throw new Meteor.Error('not-logged-in');
|
||||
|
||||
|
||||
const user = Users.findOne(this.userId);
|
||||
const assignments = user.profile?.boardWorkspaceAssignments || {};
|
||||
assignments[boardId] = spaceId;
|
||||
|
||||
|
||||
Users.update(this.userId, {
|
||||
$set: { 'profile.boardWorkspaceAssignments': assignments }
|
||||
});
|
||||
|
|
@ -2005,11 +1983,11 @@ Meteor.methods({
|
|||
unassignBoardFromWorkspace(boardId) {
|
||||
check(boardId, String);
|
||||
if (!this.userId) throw new Meteor.Error('not-logged-in');
|
||||
|
||||
|
||||
const user = Users.findOne(this.userId);
|
||||
const assignments = user.profile?.boardWorkspaceAssignments || {};
|
||||
delete assignments[boardId];
|
||||
|
||||
|
||||
Users.update(this.userId, {
|
||||
$set: { 'profile.boardWorkspaceAssignments': assignments }
|
||||
});
|
||||
|
|
@ -2023,9 +2001,11 @@ Meteor.methods({
|
|||
const user = ReactiveCache.getCurrentUser();
|
||||
user.toggleFieldsGrid(user.hasCustomFieldsGrid());
|
||||
},
|
||||
toggleCardMaximized() {
|
||||
/* #FIXME not sure about what I'm doing here, but this methods call an async method AFAIU.
|
||||
not making it wait to it creates flickering and multiple renderings on client side. */
|
||||
async toggleCardMaximized() {
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
user.toggleCardMaximized(user.hasCardMaximized());
|
||||
await user.toggleCardMaximized(user.hasCardMaximized());
|
||||
},
|
||||
setCardCollapsed(value) {
|
||||
check(value, Boolean);
|
||||
|
|
@ -2036,6 +2016,10 @@ Meteor.methods({
|
|||
const user = ReactiveCache.getCurrentUser();
|
||||
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
||||
},
|
||||
toggleShowWeekOfYear() {
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
user.toggleShowWeekOfYear(user.isShowWeekOfYear());
|
||||
},
|
||||
toggleRescueCardDescription() {
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
user.toggleRescueCardDescription(user.hasRescuedCardDescription());
|
||||
|
|
@ -2116,7 +2100,7 @@ Meteor.methods({
|
|||
check(height, Number);
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
if (user) {
|
||||
user.setSwimlaneHeightToStorage(boardId, swimlaneId, height);
|
||||
user.setSwimlaneHeightToStorage(boardId, swimlaneId, parseInt(height));
|
||||
}
|
||||
// For non-logged-in users, the client-side code will handle localStorage
|
||||
},
|
||||
|
|
@ -2133,11 +2117,6 @@ Meteor.methods({
|
|||
}
|
||||
// For non-logged-in users, the client-side code will handle localStorage
|
||||
},
|
||||
setZoomLevel(level) {
|
||||
check(level, Number);
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
user.setZoomLevel(level);
|
||||
},
|
||||
setMobileMode(enabled) {
|
||||
check(enabled, Boolean);
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
|
|
@ -3037,7 +3016,7 @@ if (Meteor.isServer) {
|
|||
// get all boards where the user is member of
|
||||
let boards = ReactiveCache.getBoards(
|
||||
{
|
||||
type: 'board',
|
||||
type: {$in: ['board', 'template-container']},
|
||||
'members.userId': req.userId,
|
||||
},
|
||||
{
|
||||
|
|
@ -3123,7 +3102,7 @@ if (Meteor.isServer) {
|
|||
// get all boards where the user is member of
|
||||
let boards = ReactiveCache.getBoards(
|
||||
{
|
||||
type: 'board',
|
||||
type: { $in: ['board', 'template-container'] },
|
||||
'members.userId': id,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue