Skip to content

Commit

Permalink
introduce allowlist for disconnectable relation types
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Nov 16, 2021
1 parent cb96257 commit c854564
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion modules/actions/disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ||
Expand Down

0 comments on commit c854564

Please sign in to comment.