Commit f1054c84 authored by Dave Barker's avatar Dave Barker 🐈

Refs #34 - Allow arbitrary URLs for notification links

parent 0a9734a0
......@@ -141,6 +141,15 @@ function getNotificationButtons({type: notificationType, links}, message)
return buttons;
}
function openNotificationLink(link)
{
// Previously all links were considered doc links, so while arbritrary URLs
// are now supported we must assume they will contain at least one "/".
let url = link.includes("/") ? link : Utils.getDocLink(link);
browser.tabs.create({url});
}
function openNotificationLinks(notificationId)
{
let buttons = buttonsByNotificationId.get(notificationId) || [];
......@@ -155,7 +164,7 @@ function openNotificationLinks(notificationId)
}
for (let link of links)
browser.tabs.create({url: Utils.getDocLink(link)});
openNotificationLink(link);
}
function notificationButtonClick(notificationId, buttonIndex)
......@@ -170,9 +179,7 @@ function notificationButtonClick(notificationId, buttonIndex)
switch (button.type)
{
case "link":
browser.tabs.create({
url: Utils.getDocLink(button.link)
});
openNotificationLink(button.link);
break;
case "open-all":
openNotificationLinks(notificationId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment