forked from MapComplete/MapComplete
Hook deleteWizard into the specialVisualisations (WIP)
This commit is contained in:
parent
5d3365afb8
commit
de5f8f95bb
3 changed files with 61 additions and 21 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue