Hook deleteWizard into the specialVisualisations (WIP)

This commit is contained in:
Pieter Vander Vennet 2021-07-01 02:43:49 +02:00
parent 5d3365afb8
commit de5f8f95bb
3 changed files with 61 additions and 21 deletions

View file

@ -10,10 +10,12 @@ export default class DeleteAction {
public readonly canBeDeleted: UIEventSource<{ canBeDeleted?: boolean, reason: Translation }>;
public readonly isDeleted = new UIEventSource<boolean>(false);
private readonly _id: string;
private readonly _allowDeletionAtChangesetCount: number;
constructor(id: string) {
constructor(id: string, allowDeletionAtChangesetCount?: number) {
this._id = id;
this._allowDeletionAtChangesetCount = allowDeletionAtChangesetCount ?? Number.MAX_VALUE;
this.canBeDeleted = new UIEventSource<{ canBeDeleted?: boolean; reason: Translation }>({
canBeDeleted: undefined,
@ -104,7 +106,7 @@ export default class DeleteAction {
if (!ud.loggedIn) {
return false;
}
return ud.csCount >= Constants.userJourney.deletePointsOfOthersUnlock;
return ud.csCount >= Math.min(Constants.userJourney.deletePointsOfOthersUnlock, this._allowDeletionAtChangesetCount);
})
const previousEditors = new UIEventSource<number[]>(undefined)