Unverified Commit 754c07bc authored by robertperez-upc's avatar robertperez-upc Committed by GitHub
Browse files

new clone name takes into account the already created clones (#1485)



new clone name takes into account the already created clones
Co-authored-by: default avatarRoberto P. Rubio <roberto@TheMatrixDesktop.matrix>
parent fba5f10a
......@@ -3197,6 +3197,18 @@ sub _cmd_clone($self, $request) {
);
}
sub _get_last_used_clone_id
{
my ($base_name, $domains) = @_;
my $last_used_id = 0;
foreach my $domain (@$domains)
{
next if ($domain->{is_base});
$last_used_id = $1 if (($domain->{name} =~ m/^$base_name\-(\d+)$/) && ($1 > $last_used_id));
}
return $last_used_id;
}
sub _req_clone_many($self, $request) {
my $args = $request->args();
my $id_domain = $args->{id_domain};
......@@ -3215,8 +3227,9 @@ sub _req_clone_many($self, $request) {
$args->{after_request} = $req_prepare->id;
}
my @reqs;
my $last_used_id = _get_last_used_clone_id($base->name, $domains);
for ( 1 .. $number ) {
my $n = $_;
my $n = $last_used_id + $_;
my $name;
for ( ;; ) {
while (length($n) < length($number)) { $n = "0".$n };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment