Created Codestriker topic at:
  
http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5172951&action=view

  User: sits    
  Date: 06/01/16 13:22:59

  Modified:    .        CHANGELOG
               lib/Codestriker/Action SubmitNewTopic.pm
               lib/Codestriker/BugDB BugzillaConnection.pm
                        FlysprayConnection.pm
               lib/Codestriker/TopicListeners BugTracking.pm Manager.pm
                        TopicListener.pm
  Log:
  * Creating a topic with an invalid bug ID is now shown as an error to
    the user on the create topic screen.
  
  
  
  Index: CHANGELOG
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
  retrieving revision 1.182
  retrieving revision 1.183
  diff -u -r1.182 -r1.183
  --- CHANGELOG 16 Jan 2006 10:49:20 -0000      1.182
  +++ CHANGELOG 16 Jan 2006 21:22:57 -0000      1.183
  @@ -11,6 +11,9 @@
     URL.  See the codestriker.conf file for more information.
     Submitted by Edwin Fine <[EMAIL PROTECTED]>.
   
  +* Creating a topic with an invalid bug ID is now shown as an error to
  +  the user on the create topic screen.
  +
   * If there was an error creating a topic, the selected project name
     was not retained when the create topic screen was redisplayed.  This
     has now been fixed.
  
  
  
  
  
  Index: SubmitNewTopic.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitNewTopic.pm,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SubmitNewTopic.pm 16 Jan 2006 10:49:23 -0000      1.23
  +++ SubmitNewTopic.pm 16 Jan 2006 21:22:58 -0000      1.24
  @@ -82,7 +82,7 @@
        $feedback .= "Topic text specified using tags and uploaded file.\n";
        $feedback .= "Please choose one topic text method, and try again.\n";
       }
  -    
  +
       $http_response->generate_header(topic_title=>"Create New Topic",
                                    email=>$email, reviewers=>$reviewers,
                                    cc=>$cc, repository=>$repository_name,
  @@ -150,6 +150,12 @@
           $projectid = $projects[0]->{id};
       }
   
  +    # Make sure all the conditions from the topic listeners are satisified.
  +    $feedback .= Codestriker::TopicListeners::Manager::topic_pre_create
  +     ($email, $topic_title, $topic_description,
  +      $bug_ids, $reviewers, $cc,
  +      $repository_url, $projectid);
  +
       # If there is a problem with the input, redirect to the create screen
       # with the message.
       if ($feedback ne "") {
  
  
  
  
  
  Index: BugzillaConnection.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/BugzillaConnection.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BugzillaConnection.pm     27 Sep 2004 11:16:45 -0000      1.4
  +++ BugzillaConnection.pm     16 Jan 2006 21:22:58 -0000      1.5
  @@ -34,6 +34,15 @@
       $self->{dbh}->disconnect;
   }
   
  +# Return true if the specified bugid exists in the bug database,
  +# false otherwise.
  +sub bugid_exists($$) {
  +    my ($self, $bugid) = @_;
  +
  +    return $self->{dbh}->selectrow_array('SELECT COUNT(*) FROM bugs ' .
  +                                      'WHERE bug_id = ?', {}, $bugid) != 0;
  +}
  +
   # Method for updating the bug with information that a code review has been
   # created/closed/committed against this bug.
   sub update_bug($$$$) {
  
  
  
  
  
  Index: FlysprayConnection.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FlysprayConnection.pm     22 May 2005 22:26:03 -0000      1.2
  +++ FlysprayConnection.pm     16 Jan 2006 21:22:58 -0000      1.3
  @@ -34,6 +34,16 @@
       $self->{dbh}->disconnect;
   }
   
  +# Return true if the specified bugid exists in the bug database,
  +# false otherwise.
  +sub bugid_exists($$) {
  +    my ($self, $bugid) = @_;
  +
  +    # TODO: update this with the appropriate SQL statement.
  +    return 1;
  +}
  +
  +
   # Method for updating the bug with information that a code review has been
   # created/closed/committed against this bug.
   sub update_bug($$$$) {
  
  
  
  
  
  Index: BugTracking.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/BugTracking.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BugTracking.pm    22 May 2005 22:26:05 -0000      1.2
  +++ BugTracking.pm    16 Jan 2006 21:22:59 -0000      1.3
  @@ -26,6 +26,27 @@
       return bless $self, $type;
   }
   
  +# Check that the nominated bugids exist in the bug database.
  +sub topic_pre_create($$) { 
  +    my ($self, $user, $topic_title, $topic_description, $bug_ids,
  +     $reviewers, $cc, $repository_url, $projectid) = @_;
  +
  +    my $feedback = '';
  +    if ($bug_ids ne '') {
  +     my @bug_ids = split /, /, $bug_ids;
  +     my $bug_db_connection =
  +         Codestriker::BugDB::BugDBConnectionFactory->getBugDBConnection();
  +     foreach my $bug_id (@bug_ids) {
  +         if (!$bug_db_connection->bugid_exists($bug_id)) {
  +             $feedback .= "Bug ID $bug_id does not exist.\n";
  +         }
  +     }
  +     $bug_db_connection->release_connection();
  +    }
  +
  +    return $feedback;    
  +}
  +
   sub topic_create($$) { 
       my ($self, $topic) = @_;
   
  
  
  
  
  
  Index: Manager.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Manager.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Manager.pm        22 May 2005 10:46:35 -0000      1.6
  +++ Manager.pm        16 Jan 2006 21:22:59 -0000      1.7
  @@ -17,6 +17,23 @@
   
   my @topic_listeners;
   
  +sub topic_pre_create { 
  +    _create_listeners();
  +    
  +    # Call all of the topic listeners that are created. If any of the
  +    # topic listeners return a non-empty string, it is treated as a 
  +    # request to reject the creation of the new topic.  Display the 
  +    # returned string as the user error message.
  +    my $returnValue = '';
  +    
  +    foreach my $listener (@topic_listeners) {
  +       $returnValue .= $listener->topic_pre_create(@_);
  +       last if length($returnValue);
  +    }
  +    
  +    return $returnValue;
  +}
  +
   sub topic_create { 
       _create_listeners();
       
  
  
  
  
  
  Index: TopicListener.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/TopicListener.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TopicListener.pm  17 Aug 2004 22:29:03 -0000      1.6
  +++ TopicListener.pm  16 Jan 2006 21:22:59 -0000      1.7
  @@ -19,6 +19,16 @@
       return bless $self, $type;
   }
   
  +sub topic_pre_create($$) { 
  +    my ($self, $user, $topic_title, $topic_description, $bug_ids,
  +     $reviewers, $cc, $repository_url, $projectid) = @_;
  +    
  +    # Default version of function that does nothing, and allowed the
  +    # event to continue.
  +
  +    return '';    
  +}
  +
   sub topic_create($$) { 
       my ($self, $user, $topic) = @_;
       
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to