Resolve merge conflicts by accepting PR #6131 changes

Co-authored-by: xet7 <15545+xet7@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-07 16:30:08 +00:00
parent dc0b68ee80
commit 97dd5d2064
257 changed files with 9483 additions and 14103 deletions

View file

@ -857,12 +857,22 @@ Boards.helpers({
);
},
listsInSwimlane(swimlaneId) {
return this.lists().filter(e => e.swimlaneId === swimlaneId);
},
/** returns the last list
* @returns Document the last list
*/
getLastList() {
const ret = ReactiveCache.getList({ boardId: this._id }, { sort: { sort: 'desc' } });
return ret;
req = { boardId: this._id };
if (this.swimlane && this.swimlane._id != this._id) {
req.swimlaneId = this.swimlane._id;
}
return ReactiveCache.getList(
req,
{ sort: { sort: 'desc' }
});
},
nullSortLists() {
@ -949,12 +959,12 @@ Boards.helpers({
const user = ReactiveCache.getUser(member.userId);
return user !== undefined;
});
// Sort by role priority first (admin, normal, normal-assigned, no-comments, comment-only, comment-assigned, worker, read-only, read-assigned), then by fullname
return _.sortBy(filteredMembers, member => {
const user = ReactiveCache.getUser(member.userId);
let rolePriority = 8; // Default for normal
if (member.isAdmin) rolePriority = 0;
else if (member.isReadAssignedOnly) rolePriority = 8;
else if (member.isReadOnly) rolePriority = 7;
@ -964,7 +974,7 @@ Boards.helpers({
else if (member.isNoComments) rolePriority = 3;
else if (member.isNormalAssignedOnly) rolePriority = 2;
else rolePriority = 1; // Normal
const fullname = user ? user.profile.fullname : '';
return rolePriority + '-' + fullname;
});
@ -1144,10 +1154,7 @@ Boards.helpers({
searchBoards(term) {
check(term, Match.OneOf(String, null, undefined));
const query = { boardId: this._id };
query.type = 'cardType-linkedBoard';
query.archived = false;
const query = { type: 'template-container', archived: false };
const projection = { limit: 10, sort: { createdAt: -1 } };
if (term) {
@ -1156,7 +1163,7 @@ Boards.helpers({
query.$or = [{ title: regex }, { description: regex }];
}
const ret = ReactiveCache.getCards(query, projection);
const ret = ReactiveCache.getBoards(query, projection);
return ret;
},
@ -1644,19 +1651,19 @@ Boards.helpers({
return await Boards.updateAsync(this._id, { $set: { allowsDescriptionText } });
},
async setallowsDescriptionTextOnMinicard(allowsDescriptionTextOnMinicard) {
async setAllowsDescriptionTextOnMinicard(allowsDescriptionTextOnMinicard) {
return await Boards.updateAsync(this._id, { $set: { allowsDescriptionTextOnMinicard } });
},
async setallowsCoverAttachmentOnMinicard(allowsCoverAttachmentOnMinicard) {
async setAllowsCoverAttachmentOnMinicard(allowsCoverAttachmentOnMinicard) {
return await Boards.updateAsync(this._id, { $set: { allowsCoverAttachmentOnMinicard } });
},
async setallowsBadgeAttachmentOnMinicard(allowsBadgeAttachmentOnMinicard) {
async setAllowsBadgeAttachmentOnMinicard(allowsBadgeAttachmentOnMinicard) {
return await Boards.updateAsync(this._id, { $set: { allowsBadgeAttachmentOnMinicard } });
},
async setallowsCardSortingByNumberOnMinicard(allowsCardSortingByNumberOnMinicard) {
async setAllowsCardSortingByNumberOnMinicard(allowsCardSortingByNumberOnMinicard) {
return await Boards.updateAsync(this._id, { $set: { allowsCardSortingByNumberOnMinicard } });
},
@ -1775,7 +1782,7 @@ Boards.userBoards = (
selector.archived = archived;
}
if (!selector.type) {
selector.type = 'board';
selector.type = { $in: ['board', 'template-container'] };
}
selector.$or = [

View file

@ -106,40 +106,53 @@ CardComments.helpers({
},
reactions() {
const cardCommentReactions = ReactiveCache.getCardCommentReaction({cardCommentId: this._id});
const reaction = this.reaction();
return !!cardCommentReactions ? cardCommentReactions.reactions : [];
},
reaction() {
return cardCommentReactions = ReactiveCache.getCardCommentReaction({ cardCommentId: this._id });
},
userReactions(userId) {
const reactions = this.reactions();
return reactions?.filter(r => r.userIds.includes(userId));
},
hasUserReacted(codepoint) {
return this.userReactions(Meteor.userId()).find(e => e.reactionCodepoint === codepoint);
},
toggleReaction(reactionCodepoint) {
if (reactionCodepoint !== sanitizeText(reactionCodepoint)) {
return false;
} else {
const cardCommentReactions = ReactiveCache.getCardCommentReaction({cardCommentId: this._id});
const reactions = !!cardCommentReactions ? cardCommentReactions.reactions : [];
const userId = Meteor.userId();
const reaction = reactions.find(r => r.reactionCodepoint === reactionCodepoint);
const reactionDoc = this.reaction();
const reactions = this.reactions();
const reactionTog = reactions.find(r => r.reactionCodepoint === reactionCodepoint);
// If no reaction is set for the codepoint, add this
if (!reaction) {
if (!reactionTog) {
reactions.push({ reactionCodepoint, userIds: [userId] });
} else {
// toggle user reaction upon previous reaction state
const userHasReacted = reaction.userIds.includes(userId);
const userHasReacted = reactionTog.userIds.includes(userId);
if (userHasReacted) {
reaction.userIds.splice(reaction.userIds.indexOf(userId), 1);
if (reaction.userIds.length === 0) {
reactions.splice(reactions.indexOf(reaction), 1);
reactionTog.userIds.splice(reactionTog.userIds.indexOf(userId), 1);
if (reactionTog.userIds.length === 0) {
reactions.splice(reactions.indexOf(reactionTog), 1);
}
} else {
reaction.userIds.push(userId);
reactionTog.userIds.push(userId);
}
}
// If no reaction doc exists yet create otherwise update reaction set
if (!!cardCommentReactions) {
return CardCommentReactions.update({ _id: cardCommentReactions._id }, { $set: { reactions } });
if (!!reactionDoc) {
return CardCommentReactions.update({ _id: reactionDoc._id }, { $set: { reactions } });
} else {
return CardCommentReactions.insert({
boardId: this.boardId,

View file

@ -1,24 +1,24 @@
import { ReactiveCache, ReactiveMiniMongoIndex } from '/imports/reactiveCache';
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
import {
formatDateTime,
formatDate,
formatTime,
getISOWeek,
isValidDate,
isBefore,
isAfter,
isSame,
add,
subtract,
startOf,
endOf,
format,
parseDate,
now,
createDate,
fromNow,
calendar
import {
formatDateTime,
formatDate,
formatTime,
getISOWeek,
isValidDate,
isBefore,
isAfter,
isSame,
add,
subtract,
startOf,
endOf,
format,
parseDate,
now,
createDate,
fromNow,
calendar
} from '/imports/lib/dateUtils';
import {
ALLOWED_COLORS,
@ -2682,16 +2682,21 @@ function cardCustomFields(userId, doc, fieldNames, modifier) {
}
function cardCreation(userId, doc) {
// For any reason some special cards also have
// special data, e.g. linked cards who have list/swimlane ID
// being their own ID
const list = ReactiveCache.getList(doc.listId);
const swim = ReactiveCache.getSwimlane(doc.listId);
Activities.insert({
userId,
activityType: 'createCard',
boardId: doc.boardId,
listName: ReactiveCache.getList(doc.listId).title,
listId: doc.listId,
listName: list?.title,
listId: list ? doc.listId : undefined,
cardId: doc._id,
cardTitle: doc.title,
swimlaneName: ReactiveCache.getSwimlane(doc.swimlaneId).title,
swimlaneId: doc.swimlaneId,
swimlaneName: swim?.title,
swimlaneId: swim ? doc.swimlaneId : undefined,
});
}
@ -4294,10 +4299,10 @@ Cards.helpers({
hasMovedFromOriginalPosition() {
const history = this.getOriginalPosition();
if (!history) return false;
const currentSwimlaneId = this.swimlaneId || null;
const currentListId = this.listId || null;
return history.originalPosition.sort !== this.sort ||
history.originalSwimlaneId !== currentSwimlaneId ||
history.originalListId !== currentListId;
@ -4309,12 +4314,12 @@ Cards.helpers({
getOriginalPositionDescription() {
const history = this.getOriginalPosition();
if (!history) return 'No original position data';
const swimlaneInfo = history.originalSwimlaneId ?
` in swimlane ${history.originalSwimlaneId}` :
const swimlaneInfo = history.originalSwimlaneId ?
` in swimlane ${history.originalSwimlaneId}` :
' in default swimlane';
const listInfo = history.originalListId ?
` in list ${history.originalListId}` :
const listInfo = history.originalListId ?
` in list ${history.originalListId}` :
'';
return `Original position: ${history.originalPosition.sort || 0}${swimlaneInfo}${listInfo}`;
},

View file

@ -103,10 +103,10 @@ export default class FileStoreStrategyFactory {
if (!storage) {
storage = fileObj.versions[versionName].storage;
if (!storage) {
if (fileObj.meta.source == "import" || fileObj.versions[versionName].meta.gridFsFileId) {
if (fileObj.meta.source == "import" || Object.hasOwnProperty(fileObj.versions[versionName].meta, 'gridFsFileId')) {
// uploaded by import, so it's in GridFS (MongoDB)
storage = STORAGE_NAME_GRIDFS;
} else if (fileObj && fileObj.versions && fileObj.versions[version] && fileObj.versions[version].meta && fileObj.versions[version].meta.pipePath) {
} else if (fileObj && fileObj.versions && fileObj.versions[versionName] && fileObj.versions[versionName].meta && Object.hasOwnProperty(fileObj.versions[versionName].meta, 'pipePath')) {
// DISABLED: S3 storage removed due to Node.js compatibility - fallback to filesystem
storage = STORAGE_NAME_FILESYSTEM;
} else {

View file

@ -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,
},
{