From: Simon Cozens Date: Tue, 10 Apr 2007 00:59:43 +0000 (+0000) Subject: I can't believe we didn't have a delete method. X-Git-Tag: 1.2+svn20070808~9 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=fdb21fe7e3d32442fad6c8acf6639de2ec055e37;p=memories.git I can't believe we didn't have a delete method. git-svn-id: http://svn.simon-cozens.org/memories/trunk@59 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- diff --git a/Memories/Photo.pm b/Memories/Photo.pm index 5ce8d95..939af00 100644 --- a/Memories/Photo.pm +++ b/Memories/Photo.pm @@ -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;