]> git.decadent.org.uk Git - memories.git/commitdiff
I can't believe we didn't have a delete method.
authorSimon Cozens <simon@simon-cozens.org>
Tue, 10 Apr 2007 00:59:43 +0000 (00:59 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Tue, 10 Apr 2007 00:59:43 +0000 (00:59 +0000)
git-svn-id: http://svn.simon-cozens.org/memories/trunk@59 041978f6-d955-411f-a9d7-1d8545c9c3c7

Memories/Photo.pm

index 5ce8d956145728a8906e6f6418b78aba0893cd95..939af0078b69d502ffe4491a5fa83bdd31cf682e 100644 (file)
@@ -211,6 +211,14 @@ sub comment :Exported {}
 sub tagedit :Exported {}
 sub similar :Exported {}
 sub sized :Exported {}
+sub delete :Exported {
+    my ($self, $r, $photo) = @_;
+    if ($photo and $photo->uploader == $r->user) {
+        $photo->delete;
+        $r->message("Photo deleted!");
+    }
+    $r->template("frontpage");
+}
 
 use Class::DBI::Plugin::Pager;
 use Class::DBI::Plugin::AbstractCount;