Skip to content

Remove PR build warning #583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions src/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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`
<div>
${iconPullRequest.node[0]}
<div class="title">
This page was created from a pull request build
${this.renderCloseButton()}
</div>
<div class="content">
See the
<a href="${addUtmParameters(this.urls.build, "notification")}"
>build's detail page</a
>
or
<a href="${this.urls.external}"
>pull request #${this.config.versions.current.slug}</a
>
for more information.
</div>
</div>
`;
}

renderCloseButton() {
library.add(faCircleXmark);
const xmark = icon(faCircleXmark, {
Expand Down
42 changes: 0 additions & 42 deletions tests/notification.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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",
);
});
});
});
</script>
Expand Down