feat: Truncate Old Name
This commit is contained in:
parent
18a979ea4e
commit
98a63e8e96
2 changed files with 7 additions and 4 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue