mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-03 19:14:03 +00:00 
			
		
		
		
	Can change group logo
This commit is contained in:
		@@ -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
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user