Fix issues when testing notifications

pull/1383/head
LASER-Yi 4 years ago
parent 56958488b6
commit 385cc214b3

@ -377,14 +377,13 @@ class LanguagesProfiles(Resource):
class Notifications(Resource): class Notifications(Resource):
@authenticate @authenticate
def patch(self): def patch(self):
protocol = request.form.get("protocol") url = request.form.get("url")
path = request.form.get("path")
asset = apprise.AppriseAsset(async_mode=False) asset = apprise.AppriseAsset(async_mode=False)
apobj = apprise.Apprise(asset=asset) apobj = apprise.Apprise(asset=asset)
apobj.add(f"{protocol}://{path}") apobj.add(url)
apobj.notify( apobj.notify(
title='Bazarr test notification', title='Bazarr test notification',

@ -84,7 +84,7 @@ const NotificationModal: FunctionComponent<ModalProps & BaseModalProps> = ({
variant="outline-secondary" variant="outline-secondary"
promise={() => { promise={() => {
if (current && current.url) { if (current && current.url) {
return SystemApi.testNotification(current.name, current.url); return SystemApi.testNotification(current.url);
} else { } else {
return null; return null;
} }

@ -137,9 +137,9 @@ class SystemApi extends BaseApi {
}); });
} }
async testNotification(protocol: string, path: string) { async testNotification(url: string) {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
this.patch<void>("/notifications", { protocol, path }) this.patch<void>("/notifications", { url })
.then(() => resolve()) .then(() => resolve())
.catch(reject); .catch(reject);
}); });

Loading…
Cancel
Save