Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/word-wrap-1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
iandees authored Nov 12, 2024
2 parents 16f2a90 + 6e3751a commit 1ab18f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ Build a bounding box URL using this page: https://osmlab.github.io/show-me-the-w
- https://osmlab.github.io/show-me-the-way/#comment=missingmaps
- `comment=missingmaps`, will only show changes where the changeset comment contained missingmaps somewhere

### Filter by feature keys

- key={string}
- Restrict viewing only edits where the changeset's features include keys equal to a string.
- https://osmlab.github.io/show-me-the-way/#key=building
- `key=building`, will only show changes where the changeset includes features with the key building

### Change the playback speed

- runTime={seconds}
Expand Down
24 changes: 13 additions & 11 deletions js/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,32 @@ class Change {

isRelevant() {
return new Promise((resolve) => {
let relevant = false;
let commentRelevance = false;
let keyRelevance = false;
const mapElement = this.neu || this.old;

if (this.context.comment == "") {
if (this.context.comment === "" && !this.context.key) {
return resolve(true);
}

this.fetchChangesetData(mapElement.changeset)
.then((changesetData) => {
relevant = (
changesetData.comment &&
changesetData.comment.toLowerCase()
.indexOf(this.context.comment.toLowerCase()) > -1
);

if (!relevant) {
commentRelevance =
this.context.comment !== "" &&
changesetData.comment?.toLowerCase()
.includes(this.context.comment.toLowerCase()) || false;

keyRelevance = Object.keys(mapElement.tags).includes(this.context.key);

if (!(commentRelevance || keyRelevance)) {
console.log(
"Skipping map element " + mapElement.id
+ " because changeset " + mapElement.changeset
+ " didn't match " + this.context.comment
+ " because it didn't match filters."
);
}

return resolve(relevant);
return resolve(commentRelevance | keyRelevance);
});
});
}
Expand Down

0 comments on commit 1ab18f8

Please sign in to comment.