mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Reject Scrum mutations and History changes until imported data is complete. Remove editing capabilities, show the pending warning and return a clear 409 for report downloads. Verify exclusion and normal access after the importer clears its marker. Thanks to xet7 !
19 lines
1.2 KiB
JavaScript
19 lines
1.2 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { getScrumBoardData, getScrumDailyHistory } from '/server/scrum';
|
|
const { sprintReport, velocityRows } = require('/models/lib/scrumReports');
|
|
|
|
export async function loadScrumChartData(userId, boardId, chartKey, options = {}) {
|
|
if (chartKey === 'scrumDaily') {
|
|
if (typeof options.sprintId !== 'string' || !options.sprintId || options.sprintId.length > 200) throw new Meteor.Error('invalid-sprint');
|
|
return getScrumDailyHistory(userId, boardId, options.sprintId);
|
|
}
|
|
const data = await getScrumBoardData(userId, boardId);
|
|
if (data.importPending) throw new Meteor.Error('scrum-import-pending', 'The Scrum import is incomplete. Report exports are unavailable.');
|
|
if (chartKey === 'scrumVelocity') return { reports: velocityRows(data.sprints), partial: data.partial };
|
|
if (chartKey !== 'scrumSprint') throw new Meteor.Error('invalid-chart');
|
|
if (typeof options.sprintId !== 'string' || options.sprintId.length > 200) throw new Meteor.Error('invalid-sprint');
|
|
const sprint = data.sprints.find(s => s._id === options.sprintId);
|
|
if (!sprint) throw new Meteor.Error('not-found', 'Sprint not found on this board');
|
|
return { reports: sprint.closeSnapshot ? [sprintReport(sprint)] : [], partial: data.partial };
|
|
}
|