Topic Text   Topic Comments (2)   Topic Properties   Topic Information sits@use...
Topic title: CVS commit: * Creating a topic with an invalid bug ID is ... Monday January 16, 2006 13:24:52

Download topic text | View in monospace font | Tab width set to 8 (change to 4)

Files in topic:  
[Jump to] codestriker/CHANGELOG  1.182   {+3,-0}
[Jump to] codestriker/lib/Codestriker/Action/SubmitNewTopic.pm  1.23   {+7,-1}
[Jump to] codestriker/lib/Codestriker/BugDB/BugzillaConnection.pm  1.4   {+9,-0}
[Jump to] codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm  1.2   {+10,-0}
[Jump to] codestriker/lib/Codestriker/TopicListeners/BugTracking.pm  1.2   {+21,-0}
[Jump to] codestriker/lib/Codestriker/TopicListeners/Manager.pm  1.6   {+17,-0}
[Jump to] codestriker/lib/Codestriker/TopicListeners/TopicListener.pm  1.6   {+10,-0}

[Add General Comment] to topic.

File codestriker/CHANGELOG (Revision 1.182) [Add File Comment] [Top] [>>]
 
Line 11 | Parallel Line 11 | Parallel
11 URL. See the codestriker.conf file for more information. 11 URL. See the codestriker.conf file for more information.
12 Submitted by Edwin Fine <edwin.m.fine@verizon.com>. 12 Submitted by Edwin Fine <edwin.m.fine@verizon.com>.
13 13
14 * Creating a topic with an invalid bug ID is now shown as an error to
15 the user on the create topic screen.
16
14 * If there was an error creating a topic, the selected project name 17 * If there was an error creating a topic, the selected project name
15 was not retained when the create topic screen was redisplayed. This 18 was not retained when the create topic screen was redisplayed. This
16 has now been fixed. 19 has now been fixed.
 
File codestriker/lib/Codestriker/Action/SubmitNewTopic.pm (Revision 1.23) [Add File Comment] [<<] [Top] [>>]
 
Line 82 | Parallel Line 82 | Parallel
82 $feedback .= "Topic text specified using tags and uploaded file.\n"; 82 $feedback .= "Topic text specified using tags and uploaded file.\n";
83 $feedback .= "Please choose one topic text method, and try again.\n"; 83 $feedback .= "Please choose one topic text method, and try again.\n";
84 } 84 }
85 85
86 $http_response->generate_header(topic_title=>"Create New Topic", 86 $http_response->generate_header(topic_title=>"Create New Topic",
87 email=>$email, reviewers=>$reviewers, 87 email=>$email, reviewers=>$reviewers,
88 cc=>$cc, repository=>$repository_name, 88 cc=>$cc, repository=>$repository_name,
 
 
Line 150 | Parallel Line 150 | Parallel
150 $projectid = $projects[0]->{id}; 150 $projectid = $projects[0]->{id};
151 } 151 }
152 152
153 # Make sure all the conditions from the topic listeners are satisified.
154 $feedback .= Codestriker::TopicListeners::Manager::topic_pre_create
155 ($email, $topic_title, $topic_description,
156 $bug_ids, $reviewers, $cc,
157 $repository_url, $projectid);
158
153 # If there is a problem with the input, redirect to the create screen 159 # If there is a problem with the input, redirect to the create screen
154 # with the message. 160 # with the message.
155 if ($feedback ne "") { 161 if ($feedback ne "") {
 
File codestriker/lib/Codestriker/BugDB/BugzillaConnection.pm (Revision 1.4) [Add File Comment] [<<] [Top] [>>]
 
Line 34 | Parallel Line 34 | Parallel
34 $self->{dbh}->disconnect; 34 $self->{dbh}->disconnect;
35 } 35 }
36 36
37 # Return true if the specified bugid exists in the bug database,
38 # false otherwise.
39 sub bugid_exists($$) {
40 my ($self, $bugid) = @_;
41
42 return $self->{dbh}->selectrow_array('SELECT COUNT(*) FROM bugs ' .
43 'WHERE bug_id = ?', {}, $bugid) != 0;
44 }
45
37 # Method for updating the bug with information that a code review has been 46 # Method for updating the bug with information that a code review has been
38 # created/closed/committed against this bug. 47 # created/closed/committed against this bug.
39 sub update_bug($$$$) { 48 sub update_bug($$$$) {
 
File codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm (Revision 1.2) [Add File Comment] [<<] [Top] [>>]
 
Line 34 | Parallel Line 34 | Parallel
34 $self->{dbh}->disconnect; 34 $self->{dbh}->disconnect;
35 } 35 }
36 36
37 # Return true if the specified bugid exists in the bug database,
38 # false otherwise.
39 sub bugid_exists($$) {
40 my ($self, $bugid) = @_;
41
42 # TODO: update this with the appropriate SQL statement.
43 return 1;
44 }
45
46
37 # Method for updating the bug with information that a code review has been 47 # Method for updating the bug with information that a code review has been
38 # created/closed/committed against this bug. 48 # created/closed/committed against this bug.
39 sub update_bug($$$$) { 49 sub update_bug($$$$) {
 
File codestriker/lib/Codestriker/TopicListeners/BugTracking.pm (Revision 1.2) [Add File Comment] [<<] [Top] [>>]
 
Line 26 | Parallel Line 26 | Parallel
26 return bless $self, $type; 26 return bless $self, $type;
27 } 27 }
28 28
29 # Check that the nominated bugids exist in the bug database.
30 sub topic_pre_create($$) {
31 my ($self, $user, $topic_title, $topic_description, $bug_ids,
32 $reviewers, $cc, $repository_url, $projectid) = @_;
33
34 my $feedback = '';
35 if ($bug_ids ne '') {
36 my @bug_ids = split /, /, $bug_ids;
37 my $bug_db_connection =
38 Codestriker::BugDB::BugDBConnectionFactory->getBugDBConnection();
39 foreach my $bug_id (@bug_ids) {
40 if (!$bug_db_connection->bugid_exists($bug_id)) {
41 $feedback .= "Bug ID $bug_id does not exist.\n";
42 }
43 }
44 $bug_db_connection->release_connection();
45 }
46
47 return $feedback;
48 }
49
29 sub topic_create($$) { 50 sub topic_create($$) {
30 my ($self, $topic) = @_; 51 my ($self, $topic) = @_;
31 52
 
File codestriker/lib/Codestriker/TopicListeners/Manager.pm (Revision 1.6) [Add File Comment] [<<] [Top] [>>]
 
Line 17 | Parallel Line 17 | Parallel
17 17
18 my @topic_listeners; 18 my @topic_listeners;
19 19
20 sub topic_pre_create {
21 _create_listeners();
22
23 # Call all of the topic listeners that are created. If any of the
24 # topic listeners return a non-empty string, it is treated as a
25 # request to reject the creation of the new topic. Display the
26 # returned string as the user error message.
27 my $returnValue = '';
28
29 foreach my $listener (@topic_listeners) {
30 $returnValue .= $listener->topic_pre_create(@_);
31 last if length($returnValue);
32 }
33
34 return $returnValue;
35 }
36
20 sub topic_create { 37 sub topic_create {
21 _create_listeners(); 38 _create_listeners();
22 39
 
File codestriker/lib/Codestriker/TopicListeners/TopicListener.pm (Revision 1.6) [Add File Comment] [<<] [Top]
 
Line 19 | Parallel Line 19 | Parallel
19 return bless $self, $type; 19 return bless $self, $type;
20 } 20 }
21 21
22 sub topic_pre_create($$) {
23 my ($self, $user, $topic_title, $topic_description, $bug_ids,
24 $reviewers, $cc, $repository_url, $projectid) = @_;
25
26 # Default version of function that does nothing, and allowed the
27 # event to continue.
28
29 return '';
30 }
31
22 sub topic_create($$) { 32 sub topic_create($$) {
23 my ($self, $user, $topic) = @_; 33 my ($self, $user, $topic) = @_;
24 34
 
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.