fix(pushover): prevent notifications when agent is disabled or unconfigured (#2304)
This commit is contained in:
@@ -45,9 +45,19 @@ class PushoverAgent
|
|||||||
}
|
}
|
||||||
|
|
||||||
public shouldSend(): boolean {
|
public shouldSend(): boolean {
|
||||||
|
const settings = this.getSettings();
|
||||||
|
|
||||||
|
if (
|
||||||
|
settings.enabled &&
|
||||||
|
settings.options.accessToken &&
|
||||||
|
settings.options.userToken
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private async getImagePayload(
|
private async getImagePayload(
|
||||||
imageUrl: string
|
imageUrl: string
|
||||||
): Promise<Partial<PushoverImagePayload>> {
|
): Promise<Partial<PushoverImagePayload>> {
|
||||||
|
|||||||
@@ -49,7 +49,12 @@ const NotificationsPushover = () => {
|
|||||||
const { data: soundsData } = useSWR<PushoverSound[]>(
|
const { data: soundsData } = useSWR<PushoverSound[]>(
|
||||||
data?.options.accessToken
|
data?.options.accessToken
|
||||||
? `/api/v1/settings/notifications/pushover/sounds?token=${data.options.accessToken}`
|
? `/api/v1/settings/notifications/pushover/sounds?token=${data.options.accessToken}`
|
||||||
: null
|
: null,
|
||||||
|
{
|
||||||
|
revalidateOnFocus: false,
|
||||||
|
revalidateOnReconnect: false,
|
||||||
|
shouldRetryOnError: false,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const NotificationsPushoverSchema = Yup.object().shape({
|
const NotificationsPushoverSchema = Yup.object().shape({
|
||||||
|
|||||||
Reference in New Issue
Block a user