Added support for mail digests

This commit is contained in:
Šesták Vít
2016-03-10 16:25:32 +01:00
parent dd99fe8e9b
commit 7b6192593d
12 changed files with 216 additions and 31 deletions

View File

@@ -51,6 +51,7 @@ yssdc{
email{
from = "info@example.com"
noSubscriberContact = "foobar@example.com"
//optional: type = "digest" or type="vulnerabilities" (default); Digest is WIP.
}
}
projects = {jobId:humanReadableName, …}

View File

@@ -0,0 +1,24 @@
# --- !Ups
CREATE TABLE "notification_digest_status" (
"user_provider_id" VARCHAR NOT NULL,
"user_provider_key" VARCHAR NOT NULL,
"last_changelog_id" INTEGER NULL
);
CREATE UNIQUE INDEX "notification_digest_status_user_idx" ON "notification_digest_status" ("user_provider_id","user_provider_key");
INSERT INTO notification_digest_status
(user_provider_id, user_provider_key, last_changelog_id)
SELECT
subscriber_provider_id AS user_provider_id,
subscriber_provider_key AS user_provider_key,
(SELECT MAX(id) from change) AS last_changelog_id
FROM vulnerability_subscription
GROUP BY subscriber_provider_id, subscriber_provider_key;
ALTER TABLE change ADD COLUMN "notified_to_somebody" BOOLEAN NOT NULL DEFAULT FALSE;
UPDATE change SET notified_to_somebody = TRUE;
# --- !Downs
drop table "notification_digest_status";
ALTER TABLE change DROP COLUMN "notified_to_somebody";