mirror of
https://github.com/wekan/wekan.git
synced 2026-11-26 09:59:41 -05:00
Use the one pending-aware board-view source for both the switcher label and every content layout. Resolve each rendered list container swimlane explicitly so an undefined relative Jade context cannot duplicate cards across lanes, and persist every board favorite through the authenticated server method. Thanks to hmeunier95 and xet7 ! Fixes #6660,
55 lines
1.7 KiB
JavaScript
55 lines
1.7 KiB
JavaScript
import Boards from '/models/boards';
|
|
|
|
Template.bookmarks.helpers({
|
|
hasStarredBoards() {
|
|
const user = ReactiveCache.getCurrentUser();
|
|
if (!user) return false;
|
|
const { starredBoards = [] } = user.profile || {};
|
|
return Array.isArray(starredBoards) && starredBoards.length > 0;
|
|
},
|
|
starredBoards() {
|
|
const user = ReactiveCache.getCurrentUser();
|
|
if (!user) return [];
|
|
const { starredBoards = [] } = user.profile || {};
|
|
if (!Array.isArray(starredBoards) || starredBoards.length === 0) return [];
|
|
return Boards.find({ _id: { $in: starredBoards } }, { sort: { sort: 1 } });
|
|
},
|
|
});
|
|
|
|
Template.bookmarks.events({
|
|
async 'click .js-toggle-star'(e) {
|
|
e.preventDefault();
|
|
const boardId = this._id;
|
|
if (ReactiveCache.getCurrentUser() && boardId) {
|
|
await Meteor.callAsync('toggleBoardStar', boardId);
|
|
}
|
|
},
|
|
});
|
|
|
|
Template.bookmarksPopup.helpers({
|
|
hasStarredBoards() {
|
|
const user = ReactiveCache.getCurrentUser();
|
|
if (!user) return false;
|
|
const { starredBoards = [] } = user.profile || {};
|
|
return Array.isArray(starredBoards) && starredBoards.length > 0;
|
|
},
|
|
starredBoards() {
|
|
const user = ReactiveCache.getCurrentUser();
|
|
if (!user) return [];
|
|
const { starredBoards = [] } = user.profile || {};
|
|
if (!Array.isArray(starredBoards) || starredBoards.length === 0) return [];
|
|
return Boards.find({ _id: { $in: starredBoards } }, { sort: { sort: 1 } });
|
|
},
|
|
});
|
|
|
|
Template.bookmarksPopup.events({
|
|
async 'click .js-toggle-star'(e) {
|
|
e.preventDefault();
|
|
const boardId = this._id;
|
|
if (ReactiveCache.getCurrentUser() && boardId) {
|
|
await Meteor.callAsync('toggleBoardStar', boardId);
|
|
}
|
|
},
|
|
});
|
|
|