diff --git a/src/notification.js b/src/notification.js index aca8f11e..8315f844 100644 --- a/src/notification.js +++ b/src/notification.js @@ -3,7 +3,6 @@ import { library, icon } from "@fortawesome/fontawesome-svg-core"; import { faCircleXmark, faFlask, - faCodePullRequest, faHourglassHalf, } from "@fortawesome/free-solid-svg-icons"; import { html, nothing, render, LitElement } from "lit"; @@ -198,18 +197,6 @@ export class NotificationElement extends LitElement { return nothing; } - if (this.config.versions.current.type === "external") { - if ( - objectPath.get( - this.config, - "addons.notifications.show_on_external", - false, - ) - ) { - return this.renderExternalVersionWarning(); - } - } - if ( this.readingLatestVersion && this.stableVersionAvailable && @@ -334,35 +321,6 @@ export class NotificationElement extends LitElement { `; } - renderExternalVersionWarning() { - library.add(faCodePullRequest); - const iconPullRequest = icon(faCodePullRequest, { - title: "This version is a pull request version", - classes: ["header", "icon"], - }); - - return html` -
- ${iconPullRequest.node[0]} -
- This page was created from a pull request build - ${this.renderCloseButton()} -
-
- See the - build's detail page - or - pull request #${this.config.versions.current.slug} - for more information. -
-
- `; - } - renderCloseButton() { library.add(faCircleXmark); const xmark = icon(faCircleXmark, { diff --git a/tests/notification.test.html b/tests/notification.test.html index a841a4da..38e76e07 100644 --- a/tests/notification.test.html +++ b/tests/notification.test.html @@ -222,22 +222,6 @@ expect(element).shadowDom.to.equal(""); }); - it("on external version", async () => { - config.versions.current.slug = "381"; - config.versions.current.type = "external"; - - const addon = new notification.NotificationAddon(config); - const element = document.querySelector("readthedocs-notification"); - - // We need to wait for the element to renders/updates before querying it - await elementUpdated(element); - - const title = element.shadowRoot.querySelector("div.title"); - expect(title.innerText).to.be.equal( - "This page was created from a pull request build", - ); - }); - it("check default CSS classes", async () => { const addon = new notification.NotificationAddon(config); const element = document.querySelector("readthedocs-notification"); @@ -296,32 +280,6 @@ // The notification should not be displayed expect(element).shadowDom.to.equal(""); }); - - it("renders when a different version was previously closed", async () => { - config.versions.current.slug = "381"; - config.versions.current.type = "external"; - - // localStorage should contain information about the previous dismissal - const addonInformation = { - "project-en-v1.0-notification": { dismissedTimestamp: 123 }, - }; - const localStorageString = JSON.stringify(addonInformation); - getLocalStorageStub - .withArgs("readthedocs-notification-storage-key") - .returns(localStorageString); - - const addon = new notification.NotificationAddon(config); - const element = document.querySelector("readthedocs-notification"); - - // We need to wait for the element to renders/updates before querying it - await elementUpdated(element); - - // The notification should be displayed normally - const title = element.shadowRoot.querySelector("div.title"); - expect(title.innerText).to.be.equal( - "This page was created from a pull request build", - ); - }); }); });