Skip to content

Commit

Permalink
fix: explorer url redirection (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
Melisa Anabella Rossi authored Dec 20, 2023
1 parent 0fe33a7 commit 6ae1f0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/entities/Place/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,18 @@ describe("Instance of URL", () => {
describe("explorerUrl", () => {
test("should return a string with an URL of a places with the realm", () => {
const url = explorerUrl({ base_position: "-9,-9", world_name: null }, "dg")
expect(url).toBe(
"https://play.decentraland.org/play/?position=-9%2C-9&realm=dg"
)
expect(url).toBe("https://play.decentraland.org/?position=-9%2C-9&realm=dg")
})
test("should return a string with an URL of a places without the realm", () => {
const url = explorerUrl({ base_position: "-9,-9", world_name: null })
expect(url).toBe("https://play.decentraland.org/play/?position=-9%2C-9")
expect(url).toBe("https://play.decentraland.org/?position=-9%2C-9")
})
test("should return a string with an URL of a world", () => {
const url = explorerUrl({
world_name: "paralax.dcl.eth",
base_position: "-9,-9",
})
expect(url).toBe(
"https://play.decentraland.org/play/?realm=paralax.dcl.eth"
)
expect(url).toBe("https://play.decentraland.org/?realm=paralax.dcl.eth")
})
})

Expand Down
2 changes: 0 additions & 2 deletions src/entities/Place/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function explorerPlaceUrl(
realm?: string
): string {
const target = new URL("/", DECENTRALAND_URL)
target.pathname = `/play/`
if (place?.base_position) {
target.searchParams.set("position", place.base_position)
}
Expand All @@ -65,7 +64,6 @@ function explorerPlaceUrl(
/** @private */
function explorerWorldUrl(place: Pick<PlaceAttributes, "world_name">): string {
const target = new URL("/", DECENTRALAND_URL)
target.pathname = `/play/`

if (place) {
target.searchParams.set("realm", place.world_name!)
Expand Down

0 comments on commit 6ae1f0f

Please sign in to comment.