mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Delete group after removing it from the group list
This commit is contained in:
parent
09c9e32d72
commit
3070cee9ca
1 changed files with 10 additions and 12 deletions
|
@ -55,9 +55,8 @@ exports.deleteGroup = async (groupID) => {
|
||||||
// loop through all sessions and delete them (in parallel)
|
// loop through all sessions and delete them (in parallel)
|
||||||
await Promise.all(Object.keys(sessions).map((session) => sessionManager.deleteSession(session)));
|
await Promise.all(Object.keys(sessions).map((session) => sessionManager.deleteSession(session)));
|
||||||
|
|
||||||
// remove group and group2sessions entry
|
// remove group2sessions entry
|
||||||
await db.remove(`group2sessions:${groupID}`);
|
await db.remove(`group2sessions:${groupID}`);
|
||||||
await db.remove(`group:${groupID}`);
|
|
||||||
|
|
||||||
// unlist the group
|
// unlist the group
|
||||||
let groups = await exports.listAllGroups();
|
let groups = await exports.listAllGroups();
|
||||||
|
@ -65,12 +64,7 @@ exports.deleteGroup = async (groupID) => {
|
||||||
|
|
||||||
const index = groups.indexOf(groupID);
|
const index = groups.indexOf(groupID);
|
||||||
|
|
||||||
if (index === -1) {
|
if (index !== -1) {
|
||||||
// it's not listed
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove from the list
|
// remove from the list
|
||||||
groups.splice(index, 1);
|
groups.splice(index, 1);
|
||||||
|
|
||||||
|
@ -78,6 +72,10 @@ exports.deleteGroup = async (groupID) => {
|
||||||
const newGroups = {};
|
const newGroups = {};
|
||||||
groups.forEach((group) => newGroups[group] = 1);
|
groups.forEach((group) => newGroups[group] = 1);
|
||||||
await db.set('groups', newGroups);
|
await db.set('groups', newGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove group entry
|
||||||
|
await db.remove(`group:${groupID}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.doesGroupExist = async (groupID) => {
|
exports.doesGroupExist = async (groupID) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue