]> git.mjollnir.org Git - cil.git/commitdiff
cil-bf35f2c7: Now doesn't add duplicates
authorAndrew Chilton <andychilton@gmail.com>
Fri, 22 Jan 2010 01:40:23 +0000 (14:40 +1300)
committerAndrew Chilton <andychilton@gmail.com>
Fri, 22 Jan 2010 01:40:23 +0000 (14:40 +1300)
issues/i_bf35f2c7.cil
lib/CIL/Issue.pm

index f5acc5328299b5eaf1c010e2ccb8d32fe5d12617..a61a59f592960dfd9c35aadeaee3c38a9908f19b 100644 (file)
@@ -1,10 +1,10 @@
 Summary: Adding a label twice actually does it
-Status: New
+Status: Finished
 CreatedBy: Andrew Chilton <andychilton@gmail.com>
 AssignedTo: Andrew Chilton <andychilton@gmail.com>
 Label: Milestone-v0.06
 Inserted: 2009-12-05T00:38:49
-Updated: 2010-01-21T22:59:19
+Updated: 2010-01-22T01:39:51
 
 Take an issue with no labels:
 
index eff317fad32497ca1f8730e19930144088cf7b98..77badac162b405f89e325143592e7b4a10fe24e8 100644 (file)
@@ -131,6 +131,9 @@ sub add_label {
     croak 'provide a label when adding one'
         unless defined $label;
 
+    # return if we already have this label
+    return if grep { $_ eq $label } @{$self->{data}{Label}};
+
     push @{$self->{data}{Label}}, $label;
     $self->flag_as_updated();
 }