Changeset tag host: Add domain and path (#689)

* Changeset tag `host`: Add domain and path

Extend the value of the changeset tag host key to include the full url of the editor. This way a reader of the changeset can open the editor based on this value.

* Remove `path` from changeset tags
This commit is contained in:
Tobias 2022-03-06 22:01:01 +01:00 committed by GitHub
parent 4837b2fe14
commit c88632ce8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -347,13 +347,10 @@ export class ChangesetHandler {
const self = this; const self = this;
return new Promise<number>(function (resolve, reject) { return new Promise<number>(function (resolve, reject) {
let path = window.location.pathname;
path = path.substr(1, path.lastIndexOf("/"));
const metadata = [ const metadata = [
["created_by", `MapComplete ${Constants.vNumber}`], ["created_by", `MapComplete ${Constants.vNumber}`],
["locale", Locale.language.data], ["locale", Locale.language.data],
["host", window.location.host], ["host", `${window.location.origin}${window.location.pathname}`],
["path", path],
["source", self.changes.state["currentUserLocation"]?.features?.data?.length > 0 ? "survey" : undefined], ["source", self.changes.state["currentUserLocation"]?.features?.data?.length > 0 ? "survey" : undefined],
["imagery", self.changes.state["backgroundLayer"]?.data?.id], ["imagery", self.changes.state["backgroundLayer"]?.data?.id],
...changesetTags.map(cstag => [cstag.key, cstag.value]) ...changesetTags.map(cstag => [cstag.key, cstag.value])
@ -408,4 +405,4 @@ export class ChangesetHandler {
} }
} }