From 4eced18604f4137a3685d4176a5294d56b6534df Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Wed, 8 Aug 2007 04:39:03 +0000 Subject: [PATCH] At least one of these changes is showstopper! git-svn-id: http://svn.simon-cozens.org/memories/trunk@68 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- Memories/Photo.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Memories/Photo.pm b/Memories/Photo.pm index 939af00..76375a5 100644 --- a/Memories/Photo.pm +++ b/Memories/Photo.pm @@ -165,7 +165,7 @@ sub upload_jpeg { Memories->zap_cache(); # Add system tags here my $tag = "date:".$photo->shot->ymd; - $photo->add_to_system_tags({tag => Memories::SystemTag->find_or_create({name =>$tag}) }); + $photo->add_to_system_tags({system_tag => Memories::SystemTag->find_or_create({name =>$tag}) }); return $photo; } @@ -179,7 +179,7 @@ sub add_rating :Exported { my ($self, $r) = @_; my $photo = $r->{objects}[0]; my $delta = $r->{params}{rating}; - if ($delta < 0 or $delta > 5) { return; } # Scammer + if ($delta <= 0 or $delta > 5) { return; } # Scammer # XXX Race $photo->rating($photo->rating() + $delta); $photo->rated($photo->rated() + 1); @@ -213,11 +213,13 @@ sub similar :Exported {} sub sized :Exported {} sub delete :Exported { my ($self, $r, $photo) = @_; + if ($r) { if ($photo and $photo->uploader == $r->user) { $photo->delete; $r->message("Photo deleted!"); } $r->template("frontpage"); + } else { $self->SUPER::delete() } } use Class::DBI::Plugin::Pager; @@ -241,10 +243,12 @@ sub view_paged_ordered { sub add_comment :Exported { my ($self, $r, $photo) = @_; $r->template("view"); + if ($r->params->{content} =~ /\S/) { $r->objects->[0]->add_to_comments({ name => $r->params->{name}, content => $r->params->{content} }); + } } use Cache::MemoryCache; -- 2.39.2