[Bast-commits] r9932 - ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller

idn at dev.catalyst.perl.org idn at dev.catalyst.perl.org
Sun Jul 22 20:40:44 GMT 2012


Author: idn
Date: 2012-07-22 20:40:44 +0000 (Sun, 22 Jul 2012)
New Revision: 9932

Modified:
   ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm
Log:
Correcting screwed up merge...

Modified: ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm
===================================================================
--- ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm	2012-07-22 20:40:19 UTC (rev 9931)
+++ ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm	2012-07-22 20:40:44 UTC (rev 9932)
@@ -138,22 +138,39 @@
 
 =cut
 
-sub update_feed : Local Args(1) {
-  my ($self, $c, $id) = @_;
-  my $feed = $c->model('FeedDB::Feed')->find({ id => $id });
-  if ( defined $feed ) {
-    $c->stash( 
-      owner => $feed->owner,
-      feed  => $feed->url,
-    );
-    if ( $c->req->param('url') ) {
-      $feed->update({ url => $c->req->param('url') })
-        or die "Error: $!";
-      $c->stash( updated => 1 );
+sub update_feed : Local Args(0) {
+    my ( $self, $c ) = @_;
+    if ( $c->req->param ) {
+        if ( $c->req->param('url')
+          && $c->req->param('email')
+          && $c->req->param('id') ) {
+
+            my $feed = $c->model('FeedDB::Feed')->find({
+                id    => $c->req->param('id'),
+                email => $c->req->param('email'),
+            });
+
+            if ( defined $feed ) {
+
+                $feed->update( { url => $c->req->param('url') } )
+                  or die "Error: $!";
+                $c->stash( updated => 1 );
+            }
+
+            else {
+                $c->stash( error => "No such user" );
+            }
+
+        }
+
+        else {
+            $c->stash( error => "All fields required." );
+        }
     }
-  } else {
-    $c->stash( error => "No such user" );
-  }
+
+    else {
+        $c->stash( error => "No such user" );
+    }
 }
 
 =head2 retrieve_key 




More information about the Bast-commits mailing list