Skip to content

Commit

Permalink
Remove the fallback logic of backup_url (#1451)
Browse files Browse the repository at this point in the history
* Refactor link handling: Replace backup_url and is_broken with status and wayback_url

* Update Playwright test for external resource to use wayback_url

* Remove fallback wayback URL logic
ibrahimjaved12 authored Dec 10, 2024
1 parent 31656ac commit d6f6c57
Showing 3 changed files with 0 additions and 30 deletions.
5 changes: 0 additions & 5 deletions base-theme/layouts/partials/external_resource_link.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{- $text := default .title .text -}}
{{- $href := default "" .external_url -}}
{{- $isBroken := default false .is_broken -}}
{{- $backupUrl := default "" .backup_url -}}
{{- $hasWarning := default true .has_external_license_warning -}}
{{- $className := printf "%s %s" "external-link" (default "" .class) -}}
{{- $onClick := "" -}}
@@ -10,9 +8,6 @@
{{/* Prevents external links from being clicked before corresponding JS is fully loaded. */}}
{{- $onClick = "event.preventDefault()" -}}
{{- end -}}
{{- if and $isBroken $backupUrl -}}
{{- $href = $backupUrl -}}
{{- end -}}
{{- if not (in $href "ocw.mit.edu") -}}
{{- partial "link" (dict
"href" $href

This file was deleted.

15 changes: 0 additions & 15 deletions tests-e2e/ocw-ci-test-course/external-resources.spec.ts
Original file line number Diff line number Diff line change
@@ -59,21 +59,6 @@ test("External resource in page opens a new tab", async ({ page }) => {
)
})

test("Broken external resource opens backup_url", async ({ page }) => {
const course = new CoursePage(page, "course")
await course.goto("/pages/external-resources-page")

const link = page.getByRole("link", { name: "broken external resource" })

const targetAttribute = await link.getAttribute("target")
expect(targetAttribute).toBeNull()

const classAttribute = await link.getAttribute("class")
expect(classAttribute).toBeNull()

await link.click()
})

test("External resource opens confirmation modal", async ({ page }) => {
const course = new CoursePage(page, "course")
await course.goto("/pages/external-resources-page")

0 comments on commit d6f6c57

Please sign in to comment.