introduce allowlist for disconnectable relation types

This commit is contained in:
Martin Raifer
2021-11-16 18:03:51 +01:00
parent cb96257c63
commit c854564389
2 changed files with 10 additions and 1 deletions
+2
View File
@@ -48,6 +48,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :camera: Street-Level
* Rename OpenStreetCam overlay to KartaView ([#8807])
#### :white_check_mark: Validation
* Allow disconnecting members of certain "grouping" types of relation ([#8771])
* Clarify description of "disconnected way" validation rule ([#8800])
#### :bug: Bugfixes
* Fix hidden tooltips on map control toolbar ([#8781])
@@ -60,6 +61,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Add colours for preset categories ([#8799])
#### :hammer: Development
[#8771]: https://github.com/openstreetmap/iD/issues/8771
[#8781]: https://github.com/openstreetmap/iD/issues/8781
[#8792]: https://github.com/openstreetmap/iD/pull/8792
[#8796]: https://github.com/openstreetmap/iD/issues/8796
+8 -1
View File
@@ -18,6 +18,11 @@ import { osmNode } from '../osm/node';
export function actionDisconnect(nodeId, newNodeId) {
var wayIds;
var disconnectableRelationTypes = {
'associatedStreet': true,
'enforcement': true,
'site': true,
};
var action = function(graph) {
var node = graph.entity(nodeId);
@@ -88,7 +93,9 @@ export function actionDisconnect(nodeId, newNodeId) {
parentWays.forEach(function(way) {
var relations = graph.parentRelations(way);
relations.forEach(function(relation) {
relations
.filter(relation => !disconnectableRelationTypes[relation.tags.type])
.forEach(function(relation) {
if (relation.id in seenRelationIds) {
if (wayIds) {
if (wayIds.indexOf(way.id) !== -1 ||