From 66893b5015d3ce31e19d5f16f7aeec3592ef24b5 Mon Sep 17 00:00:00 2001 From: Ealhad Date: Thu, 15 Nov 2018 00:29:55 +0100 Subject: [PATCH] Remove superfluous function --- src/background.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/background.ts b/src/background.ts index 2b8d99e..fd414b2 100644 --- a/src/background.ts +++ b/src/background.ts @@ -68,7 +68,7 @@ const redirectPeertube = async (r) => { if (prefs.redirectPeertube == RedirectType.Auto) { const id = _.last(_.split('/', r.url)); - const video: any = await searchByID(id); + const video: any = await PeertubeAPI.getVideo(id); if (prefs.openInOriginalInstance && video.account.host === hostname) { return {}; // Don't redirect if original instance @@ -97,17 +97,12 @@ const searchByName = query => new Promise(async (resolve, reject) => { }); }); -const searchByID = id => new Promise(async (resolve, reject) => { - PeertubeAPI.getVideo(id) - .then(video => resolve(video)); -}); - browser.runtime.onMessage.addListener(function(message, sender) { switch (message.kind) { case MessageKind.SearchByName: return searchByName(message.query); case MessageKind.SearchByID: - return searchByID(message.id); + return PeertubeAPI.getVideo(message.id); } });