mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -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.
41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
|
|
// #6919: DDP merges only top-level fields. This publication used to send the
|
|
// current user `{ profile: { showDesktopDragHandles } }`; when it ran before
|
|
// the accounts publication of the whole profile (Meteor re-runs named
|
|
// subscriptions first on every login, a reconnect included), that one-field
|
|
// profile won, and the client's profile stayed `{}` until the page was
|
|
// reloaded. Every preference read from 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. So, like userBoardView, the preference is
|
|
// published under a top-level field of its own and never competes for
|
|
// `profile`. tests/noNarrowProfileForCurrentUser6919.test.cjs.
|
|
Meteor.publish('userDesktopDragHandles', async function() {
|
|
if (!this.userId) return this.ready();
|
|
let stopped = false;
|
|
let handle;
|
|
this.onStop(() => {
|
|
stopped = true;
|
|
if (handle) handle.stop();
|
|
});
|
|
const preference = fields => {
|
|
const value = fields.profile?.showDesktopDragHandles;
|
|
return { desktopDragHandlesPreference: typeof value === 'boolean' ? value : null };
|
|
};
|
|
handle = await Meteor.users.find({ _id: this.userId }, {
|
|
fields: { 'profile.showDesktopDragHandles': 1 },
|
|
}).observeChangesAsync({
|
|
added: (id, fields) => {
|
|
if (!stopped) this.added('users', id, preference(fields));
|
|
},
|
|
changed: (id, fields) => {
|
|
if (!stopped && 'profile' in fields) this.changed('users', id, preference(fields));
|
|
},
|
|
removed: id => {
|
|
if (!stopped) this.removed('users', id);
|
|
},
|
|
});
|
|
if (stopped) handle.stop();
|
|
else this.ready();
|
|
});
|