mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Prevent deleting features with Wikidata tags (close #5853)
This commit is contained in:
@@ -146,6 +146,9 @@ en:
|
||||
connected_to_hidden:
|
||||
single: This feature can't be deleted because it is connected to a hidden feature.
|
||||
multiple: These features can't be deleted because some are connected to hidden features.
|
||||
has_wikidata_tag:
|
||||
single: This feature can't be deleted because it has a Wikidata tag.
|
||||
multiple: These feature can't be deleted because some have Wikidata tags.
|
||||
add_member:
|
||||
annotation: Added a member to a relation.
|
||||
delete_member:
|
||||
|
||||
Vendored
+4
@@ -185,6 +185,10 @@
|
||||
"connected_to_hidden": {
|
||||
"single": "This feature can't be deleted because it is connected to a hidden feature.",
|
||||
"multiple": "These features can't be deleted because some are connected to hidden features."
|
||||
},
|
||||
"has_wikidata_tag": {
|
||||
"single": "This feature can't be deleted because it has a Wikidata tag.",
|
||||
"multiple": "These feature can't be deleted because some have Wikidata tags."
|
||||
}
|
||||
},
|
||||
"add_member": {
|
||||
|
||||
@@ -76,9 +76,16 @@ export function operationDelete(selectedIDs, context) {
|
||||
reason = 'part_of_relation';
|
||||
} else if (selectedIDs.some(incompleteRelation)) {
|
||||
reason = 'incomplete_relation';
|
||||
} else if (selectedIDs.some(hasWikidataTag)) {
|
||||
reason = 'has_wikidata_tag';
|
||||
}
|
||||
return reason;
|
||||
|
||||
function hasWikidataTag(id) {
|
||||
var entity = context.entity(id);
|
||||
return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
|
||||
}
|
||||
|
||||
function incompleteRelation(id) {
|
||||
var entity = context.entity(id);
|
||||
return entity.type === 'relation' && !entity.isComplete(context.graph());
|
||||
|
||||
Reference in New Issue
Block a user