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

idn at dev.catalyst.perl.org idn at dev.catalyst.perl.org
Sun Jul 22 19:15:04 GMT 2012


Author: idn
Date: 2012-07-22 19:15:04 +0000 (Sun, 22 Jul 2012)
New Revision: 9925

Modified:
   ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm
Log:
Re-merging update_feed

Modified: ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm
===================================================================
--- ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm	2012-07-04 11:52:06 UTC (rev 9924)
+++ ironman/IronMan-Web/trunk/lib/IronMan/Web/Controller/Root.pm	2012-07-22 19:15:04 UTC (rev 9925)
@@ -138,31 +138,22 @@
 
 =cut
 
-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." );
-        }
+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 );
     }
+  } else {
+    $c->stash( error => "No such user" );
+  }
 }
 
 =head2 retrieve_key 




More information about the Bast-commits mailing list