Skip to content

Commit aaa65b0

Browse files
authored
Fix issue with null current build validation (#613)
When a project is private and version private the current build can be null. This was presenting as an exception in validation, especially for the notification addon.
1 parent 948464a commit aaa65b0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/data-validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ const addons_notifications = {
369369
required: ["current"],
370370
properties: {
371371
current: {
372-
type: "object",
372+
type: ["object", "null"],
373373
required: ["urls"],
374374
properties: {
375375
urls: {

tests/notification.test.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@
238238
);
239239
});
240240

241+
it("handles null current build", async () => {
242+
config.builds.current = null;
243+
244+
expect(notification.NotificationAddon.isConfigValid(config)).to.be
245+
.true;
246+
});
247+
241248
it("check default CSS classes", async () => {
242249
const addon = new notification.NotificationAddon(config);
243250
const element = document.querySelector("readthedocs-notification");

0 commit comments

Comments
 (0)