forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
@ -1,61 +1,61 @@
|
|||
import {OsmObject} from "../OsmObject";
|
||||
import OsmChangeAction from "./OsmChangeAction";
|
||||
import {Changes} from "../Changes";
|
||||
import {ChangeDescription} from "./ChangeDescription";
|
||||
import ChangeTagAction from "./ChangeTagAction";
|
||||
import {TagsFilter} from "../../Tags/TagsFilter";
|
||||
import {And} from "../../Tags/And";
|
||||
import {Tag} from "../../Tags/Tag";
|
||||
import { OsmObject } from "../OsmObject"
|
||||
import OsmChangeAction from "./OsmChangeAction"
|
||||
import { Changes } from "../Changes"
|
||||
import { ChangeDescription } from "./ChangeDescription"
|
||||
import ChangeTagAction from "./ChangeTagAction"
|
||||
import { TagsFilter } from "../../Tags/TagsFilter"
|
||||
import { And } from "../../Tags/And"
|
||||
import { Tag } from "../../Tags/Tag"
|
||||
|
||||
export default class DeleteAction extends OsmChangeAction {
|
||||
|
||||
private readonly _softDeletionTags: TagsFilter;
|
||||
private readonly _softDeletionTags: TagsFilter
|
||||
private readonly meta: {
|
||||
theme: string,
|
||||
specialMotivation: string,
|
||||
theme: string
|
||||
specialMotivation: string
|
||||
changeType: "deletion"
|
||||
};
|
||||
private readonly _id: string;
|
||||
private _hardDelete: boolean;
|
||||
}
|
||||
private readonly _id: string
|
||||
private _hardDelete: boolean
|
||||
|
||||
|
||||
constructor(id: string,
|
||||
softDeletionTags: TagsFilter,
|
||||
meta: {
|
||||
theme: string,
|
||||
specialMotivation: string
|
||||
},
|
||||
hardDelete: boolean) {
|
||||
constructor(
|
||||
id: string,
|
||||
softDeletionTags: TagsFilter,
|
||||
meta: {
|
||||
theme: string
|
||||
specialMotivation: string
|
||||
},
|
||||
hardDelete: boolean
|
||||
) {
|
||||
super(id, true)
|
||||
this._id = id;
|
||||
this._hardDelete = hardDelete;
|
||||
this.meta = {...meta, changeType: "deletion"};
|
||||
this._softDeletionTags = new And([softDeletionTags,
|
||||
new Tag("fixme", `A mapcomplete user marked this feature to be deleted (${meta.specialMotivation})`)
|
||||
]);
|
||||
|
||||
this._id = id
|
||||
this._hardDelete = hardDelete
|
||||
this.meta = { ...meta, changeType: "deletion" }
|
||||
this._softDeletionTags = new And([
|
||||
softDeletionTags,
|
||||
new Tag(
|
||||
"fixme",
|
||||
`A mapcomplete user marked this feature to be deleted (${meta.specialMotivation})`
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
public async CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
|
||||
|
||||
const osmObject = await OsmObject.DownloadObjectAsync(this._id)
|
||||
|
||||
if (this._hardDelete) {
|
||||
return [{
|
||||
meta: this.meta,
|
||||
doDelete: true,
|
||||
type: osmObject.type,
|
||||
id: osmObject.id,
|
||||
}]
|
||||
} else {
|
||||
return await new ChangeTagAction(
|
||||
this._id, this._softDeletionTags, osmObject.tags,
|
||||
return [
|
||||
{
|
||||
...this.meta,
|
||||
changeType: "soft-delete"
|
||||
}
|
||||
).CreateChangeDescriptions(changes)
|
||||
meta: this.meta,
|
||||
doDelete: true,
|
||||
type: osmObject.type,
|
||||
id: osmObject.id,
|
||||
},
|
||||
]
|
||||
} else {
|
||||
return await new ChangeTagAction(this._id, this._softDeletionTags, osmObject.tags, {
|
||||
...this.meta,
|
||||
changeType: "soft-delete",
|
||||
}).CreateChangeDescriptions(changes)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue