mirror of
https://github.com/wekan/wekan.git
synced 2026-11-20 14:45:01 -05:00
The fold was stored, and half a second later the checklist unfolded again.
DDP merges only top-level fields, and Meteor re-runs named subscriptions
before the accounts publication of the whole profile on every login, a
reconnect included. userDesktopDragHandles sent the current user
{ profile: { showDesktopDragHandles } }, and user-miniprofile, user-search,
notificationUsers, the card search and report, the boards report, People,
the impersonation report and the Chat view's comment authors sent a few
profile.* fields that could include the current user. When one of them won,
the client's profile shrank to those fields until a reload, and every
preference in it went back to its default; #6691 had found the same for the
board view and fixed only that one.
userDesktopDragHandles now publishes the preference under its own top-level
field, as userBoardView does, and utils.js reads it when the profile has
none. Every other publication leaves the current user out
(server/lib/notCurrentUser.js); their own document is published in full
already, and user-admin now also publishes createdAt, loginDisabled,
lastConnectionDate and importUsernames for the user's own row on the admin
pages.
tests/noNarrowProfileForCurrentUser6919.test.cjs finds every users query
with profile subfields in a server file that publishes and requires it to
leave the current user out (verified to fail when one does not).
tests/playwright/specs/minicard-checklist-collapse-6919.e2e.js folds and
unfolds a minicard checklist in Persian after a page load and after a
reconnect, on the reporter's card, a second checklist, a linked card, a user
with 300 earlier folds and both swimlanes of a shared list header row, and
checks the fold survives the server's answer, in the database and on the
client. Before the fix 4 of 24 reconnect runs unfolded; with it 24 of 24 and
the whole spec pass in Chromium.
Thanks to mimZD and xet7 !
Fixes #6919.
21 lines
1.0 KiB
JavaScript
21 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
// #6919: a publication that sends users with only a few `profile.*` fields must
|
|
// never send the CURRENT user. DDP merges only top-level fields, so such a
|
|
// publication competes with the accounts publication of the user's whole
|
|
// profile; Meteor re-runs named subscriptions before the accounts one on every
|
|
// login - a reconnect included - and the narrow one then wins. The client's
|
|
// profile shrank to those few fields until the page was reloaded, and every
|
|
// preference in it went back to its default: a checklist folded on a minicard
|
|
// unfolded half a second later, and #6691 had found the same for the board
|
|
// view. The current user's own document is published in full already (and its
|
|
// other top-level fields by `user-admin`), so leaving it out loses nothing.
|
|
// tests/noNarrowProfileForCurrentUser6919.test.cjs finds every such
|
|
// publication and requires this.
|
|
function notCurrentUser(selector, userId) {
|
|
if (!userId) return selector;
|
|
return { $and: [selector || {}, { _id: { $ne: userId } }] };
|
|
}
|
|
|
|
module.exports = { notCurrentUser };
|