mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-06 03:11:22 +00:00
Better test for whether untagged entities can be deleted
Now entities can always be deleted if the user created them in the first place.. We skip asking `operationDelete.disabled()` because there are reasons why this may return true. A thing that could happen before: - User creates an untagged entity - Quits browser and restarts iD - Restores history - The entity happens to be in a part of the map that hasn't been loaded yet, so `operationDelete.disabled()` returns true, and the issue ends up as a 'warning' instead of an 'error'
This commit is contained in:
@@ -62,9 +62,15 @@ export function validationMissingTag() {
|
||||
})
|
||||
];
|
||||
|
||||
var canDelete = false;
|
||||
if (!operationDelete([entity.id], context).disabled()) {
|
||||
canDelete = true;
|
||||
// can always delete if the user created it in the first place..
|
||||
var canDelete = (entity.version === undefined || entity.v !== undefined);
|
||||
|
||||
// otherwise check with operationDelete whether we can delete this entity
|
||||
if (!canDelete) {
|
||||
canDelete = !operationDelete([entity.id], context).disabled();
|
||||
}
|
||||
|
||||
if (canDelete) {
|
||||
fixes.push(
|
||||
new validationIssueFix({
|
||||
icon: 'iD-operation-delete',
|
||||
@@ -80,12 +86,9 @@ export function validationMissingTag() {
|
||||
);
|
||||
}
|
||||
|
||||
// error if created or modified and is deletable, else warning
|
||||
var isError = (entity.version === undefined || entity.v !== undefined) && canDelete;
|
||||
|
||||
return [new validationIssue({
|
||||
type: type,
|
||||
severity: isError ? 'error' : 'warning',
|
||||
severity: canDelete ? 'error' : 'warning',
|
||||
message: t('issues.missing_tag.' + missingTagType + '.message', messageObj),
|
||||
reference: showReference,
|
||||
entities: [entity],
|
||||
|
||||
Reference in New Issue
Block a user