From 08f2a0505303e8278438e3f060534856340356a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 7 Feb 2022 10:30:46 -0500 Subject: [PATCH] fix: #10255, create verified/unverified groups on install --- src/install.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/install.js b/src/install.js index 7016662d05..3067a05ab5 100644 --- a/src/install.js +++ b/src/install.js @@ -222,6 +222,35 @@ async function enableDefaultTheme() { }); } +async function createDefaultUserGroups() { + const groups = require('./groups'); + async function createGroup(name) { + await groups.create({ + name: name, + hidden: 1, + private: 1, + system: 1, + disableLeave: 1, + disableJoinRequests: 1, + }); + } + + const [verifiedExists, unverifiedExists, bannedExists] = await groups.exists([ + 'verified-users', 'unverified-users', 'banned-users', + ]); + if (!verifiedExists) { + await createGroup('verified-users'); + } + + if (!unverifiedExists) { + await createGroup('unverified-users'); + } + + if (!bannedExists) { + await createGroup('banned-users'); + } +} + async function createAdministrator() { const Groups = require('./groups'); const memberCount = await Groups.getMemberCount('administrators'); @@ -498,6 +527,7 @@ install.setup = async function () { await setupDefaultConfigs(); await enableDefaultTheme(); await createCategories(); + await createDefaultUserGroups(); const adminInfo = await createAdministrator(); await createGlobalModeratorsGroup(); await giveGlobalPrivileges();