feat: Truncate Old Name

This commit is contained in:
Lilly Schramm 2025-06-20 21:33:17 +02:00
parent 18a979ea4e
commit 98a63e8e96
2 changed files with 7 additions and 4 deletions

View file

@ -739,12 +739,15 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
@bindThis
public async clone(role: MiRole, moderator?: MiUser): Promise<MiRole> {
let newName = `${role.name} (cloned)`;
const suffix = ' (cloned)';
let newName = role.name;
if (newName.length > 256) {
newName = newName.slice(0, 256);
if (newName.length > 256 - suffix.length) {
newName = newName.slice(0, 256 - suffix.length);
}
newName += suffix;
return this.create({
...role,
name: newName,