[siesta-commit] siesta/lib/Siesta/Plugin Subscribe.pm,1.4,1.5

[prev] [thread] [next] [lurker] [Date index for 2002/09/12]

From: muttley
Subject: [siesta-commit] siesta/lib/Siesta/Plugin Subscribe.pm,1.4,1.5
Date: 16:51 on 12 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta/Plugin
In directory usw-pr-cvs1:/tmp/cvs-serv18727/lib/Siesta/Plugin

Modified Files:
	Subscribe.pm 
Log Message:
Fix database b0rking by the Subscribe plugin.


Index: Subscribe.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Subscribe.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Subscribe.pm	10 Sep 2002 18:24:21 -0000	1.4
+++ Subscribe.pm	12 Sep 2002 15:51:07 -0000	1.5
@@ -12,7 +12,16 @@
     my $mail = shift;
     my $list = $mail->list;
 
-    if ( $list->add_member( $mail->from ) ) {
+    my $user_id = $mail->from();
+
+    my $user = Siesta::User->new($user_id);
+
+    unless (defined $user) {
+	    $user = Siesta::User->new_from_hash(id=>$user_id);
+	    $user->save();
+    }
+
+    if ( $list->add_member( $user_id ) ) {
         $mail->reply( body => <<END);
 Hi,
  You have been successfully subscribed to ${ \( $list->id ) }



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52