1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 00:25:17 +00:00

Can change group logo

This commit is contained in:
2019-12-26 14:14:42 +01:00
parent 6be2cda9fb
commit 84a98506dc
4 changed files with 78 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import { GroupMembershipLevels, GroupMember } from "../entities/GroupMember";
import { NewGroup } from "../entities/NewGroup";
import { time } from "../utils/DateUtils";
import { GroupSettings } from "../entities/GroupSettings";
import { existsSync, unlinkSync } from "fs";
/**
* Groups helper
@ -14,6 +15,8 @@ import { GroupSettings } from "../entities/GroupSettings";
const GROUPS_LIST_TABLE = "comunic_groups";
const GROUPS_MEMBERS_TABLE = "comunic_groups_members";
export const PATH_GROUPS_LOGOS = "groups_logo";
export class GroupsHelper {
@ -116,6 +119,25 @@ export class GroupsHelper {
});
}
/**
* Delete the logo of a group
*
* @param groupID Target group ID
*/
public static async DeleteLogo(groupID: number) {
const currSettings = await this.GetInfo(groupID);
if(!currSettings.hasLogo)
return;
if(existsSync(currSettings.logoSysPath))
unlinkSync(currSettings.logoSysPath);
currSettings.logo = "";
await this.SetSettings(currSettings);
}
/**
* Get the visibility level of a group
*