mirror of
https://github.com/wekan/wekan.git
synced 2026-11-07 11:02:33 -05:00
The rspack client build treats a `module.exports` file imported into the
client bundle as an ES module and throws
"ES Modules may not assign module.exports" at evaluation time, aborting
the whole client module chain (No such template: swimlane / notifications
/ boardButtons, blank board, missing top bar). This is not an rspack
version regression (the lockfile has pinned ~1.7.x since v8.40); it is
that WeKan added CommonJS helpers to the client bundle.
Convert the 42 client-reachable pure-logic models/lib helpers from
`module.exports = { ... }` to `export { ... }`, and calendarFilter's
internal require('./swimlaneFilter') to an import with a .js extension
(node ESM needs it; rspack/reify tolerate it). Server-only helpers that
use node built-ins (fs/path/child_process) stay CommonJS. The plain-Node
.cjs unit tests for these helpers now use `await import(...js)` (wrapped
in an async IIFE); a source-guard in importVirtualMembers was updated
from module.exports to export. Verified: the full tests/*.test.cjs suite
has the SAME 7 pre-existing failures as before this change and no new
ones.
23 lines
1.1 KiB
JavaScript
23 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
// #3606 "activity feed shows 'edited comment undefined' / 'deleted comment
|
|
// undefined'". The activity template fed the comment's ID into the "%s" of the
|
|
// activity-editComment / activity-deleteComment strings. On older activities
|
|
// commentId was absent (→ literally "undefined"), and even when present it is an
|
|
// opaque id, not the comment text; for a DELETED comment the CardComment doc is
|
|
// already gone, so it cannot be looked up live either.
|
|
//
|
|
// The edit/delete activities now store the comment text (commentText), and this
|
|
// helper picks the best text to display — the stored text, else the live
|
|
// comment's text (edit case, comment still exists), else an empty string so the
|
|
// feed never renders the word "undefined". Meteor-free and unit tested.
|
|
function commentActivityDisplayText(activity) {
|
|
if (!activity) return '';
|
|
if (typeof activity.commentText === 'string') return activity.commentText;
|
|
const live = activity.comment;
|
|
if (live && typeof live.text === 'string') return live.text;
|
|
return '';
|
|
}
|
|
|
|
export { commentActivityDisplayText };
|