mirror of
https://github.com/wekan/wekan.git
synced 2026-11-07 11:02:33 -05:00
Five more of the features other kanban apps call AI, done with plain code (docs/Features/General/Assistants/Assistants.md): - Board menu -> Summary: what each person did in the last day or week - done, moved, added, commented - and what they have overdue, from the activities and History; Copy as text gives Markdown with card links. - Board menu -> Since your last visit (N): what others changed since the visit before this one, by card. The visit is kept in profile.boardVisits, at most 500 boards. - At risk: a weighted score of overdue, due soon with little done, blocked, idle in a middle list and sent back; a triangle on the minicard and the reasons in the opened card. - Suggested members in the Members and Assignees popups, from who handles the same labels, list and swimlane. - Forecast done date: the 50th and 85th percentile of the board's cycle times, counting only the cards that took at least as long as this one has been open. The server sends the times once per board, numbers only. Summary and Since your last visit are features of Admin Panel / Settings / Visibility / Features; At risk, Suggested members and Forecast are rows of Board Settings / Card and of the Admin Panel's Card fields. Every server answer applies the board's read rules and the assigned-only role. Translated in every language. The guards of the earlier helpers are brought up to date as well: the date words of models/lib/titleDueDate.js are a reviewed RegExp site, server/methods/ruleSuggestions.js is a board-admin-only path, the Rules page's list branch carries the suggestions, and Tigre's new strings use its own word for a board. Thanks to xet7 !
28 lines
1.4 KiB
JavaScript
28 lines
1.4 KiB
JavaScript
// #6736: the instance's feature decisions (Admin Panel / Settings / Visibility /
|
|
// Features) for the signed-in user, reactively. The decisions themselves are
|
|
// models/lib/instanceFeatures.js; this only supplies what the client knows -
|
|
// the published Settings document and the user's own preview flag.
|
|
import { Template } from 'meteor/templating';
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { currentUserWith } from '/client/lib/currentUserWith';
|
|
const { isBoardViewAvailable, isFeatureAvailable } = require('/models/lib/instanceFeatures');
|
|
|
|
// #6745: only the two fields canPreviewFeatures() reads. Utils.boardView()
|
|
// calls this, and every list's card loop reads boardView(): with the whole user
|
|
// document here, a card open (a user write) re-ran every list and Blaze then
|
|
// re-evaluated every minicard.
|
|
const PREVIEW_USER_FIELDS = ['featurePreview', 'isAdmin'];
|
|
|
|
export function allowBoardView(view) {
|
|
return isBoardViewAvailable(ReactiveCache.getCurrentSetting(), currentUserWith(PREVIEW_USER_FIELDS), view);
|
|
}
|
|
|
|
// A catalog feature without a board view of its own (the helpers that need no
|
|
// AI: rule suggestions, ...), for the signed-in user.
|
|
export function allowFeature(key) {
|
|
return isFeatureAvailable(ReactiveCache.getCurrentSetting(), currentUserWith(PREVIEW_USER_FIELDS), key);
|
|
}
|
|
|
|
// {{#if allowFeature 'board-summary'}} in a template.
|
|
Template.registerHelper('allowFeature', key => allowFeature(key));
|