]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 565880: Do not throw an error when obsoleting an already obsolete attachment
authorFrédéric Buclin <LpSolit@gmail.com>
Fri, 14 May 2010 13:31:14 +0000 (15:31 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 14 May 2010 13:31:14 +0000 (15:31 +0200)
a=LpSolit

Bugzilla/Attachment.pm
template/en/default/global/code-error.html.tmpl

index f3210425f08122c0ae5c57d4358908d96f2029d5..33cb12bb6eb377758f97156832decbb8f9d53d44 100644 (file)
@@ -734,7 +734,7 @@ sub validate_can_edit {
                  && $user->in_group('editbugs', $product_id))) ? 1 : 0;
 }
 
-=item C<validate_obsolete($bug)>
+=item C<validate_obsolete($bug, $attach_ids)>
 
 Description: validates if attachments the user wants to mark as obsolete
              really belong to the given bug and are not already obsolete.
@@ -742,8 +742,10 @@ Description: validates if attachments the user wants to mark as obsolete
              he cannot view it (due to restrictions on it).
 
 Params:      $bug - The bug object obsolete attachments should belong to.
+             $attach_ids - The list of attachments to mark as obsolete.
 
-Returns:     1 on success. Else an error is thrown.
+Returns:     The list of attachment objects to mark as obsolete.
+             Else an error is thrown.
 
 =cut
 
@@ -777,9 +779,7 @@ sub validate_obsolete {
             ThrowCodeError('mismatched_bug_ids_on_obsolete', $vars);
         }
 
-        if ($attachment->isobsolete) {
-          ThrowCodeError('attachment_already_obsolete', $vars);
-        }
+        next if $attachment->isobsolete;
 
         push(@obsolete_attachments, $attachment);
     }
index 70dc64ab143445451a04c08d15856ca545e2fdef..c91bc66eeb3fb873dae6cdd6c5d4a6cb8dc53fc3 100644 (file)
     I don't recognize the value (<em>[% action FILTER html %]</em>)
     of the <em>action</em> variable.
   
-  [% ELSIF error == "attachment_already_obsolete" %]
-    Attachment #[% attach_id FILTER html %] ([% description FILTER html %]) 
-    is already obsolete.
-
   [% ELSIF error == "attachment_local_storage_disabled" %]
     [% title = "Local Storage Disabled" %]
     You cannot store attachments locally. This feature is disabled.