Add updateNotificationsForBetaVersions option

cshd
Dragory 2020-09-23 00:25:50 +03:00
parent f46d719f4c
commit 171ad403d9
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
3 changed files with 12 additions and 3 deletions

View File

@ -317,6 +317,10 @@ If enabled, any time a moderator is typing in a modmail thread, the user will se
**Default:** `on`
If enabled, the bot will automatically check for new bot updates periodically and notify about them at the top of new modmail threads
#### updateNotificationsForBetaVersions
**Default:** `off`
If enabled, update notifications will also be given for new beta versions
#### url
**Default:** *None*
URL to use for attachment and log links. Defaults to `http://IP:PORT`.

View File

@ -265,6 +265,11 @@
"default": true
},
"updateNotificationsForBetaVersions": {
"$ref": "#/definitions/customBoolean",
"default": false
},
"plugins": {
"type": "array",
"items": {

View File

@ -62,10 +62,10 @@ async function refreshVersions() {
const parsed = JSON.parse(data);
if (! Array.isArray(parsed) || parsed.length === 0) return;
const latestStableRelease = parsed.find(r => ! r.prerelease && ! r.draft);
if (! latestStableRelease) return;
const latestMatchingRelease = parsed.find(r => ! r.draft && (config.updateNotificationsForBetaVersions || ! r.prerelease));
if (! latestMatchingRelease) return;
const latestVersion = latestStableRelease.name;
const latestVersion = latestMatchingRelease.name;
await knex("updates").update({
available_version: latestVersion,
last_checked: moment.utc().format("YYYY-MM-DD HH:mm:ss")