Fixed the submission of a code review and the display.

The display of a code review was crashing when a new file was added in
the diff.
The form to submit a review now proposes directly a choice of commits.
dev
Loic d'Anterroches 2009-02-02 17:38:48 +01:00
parent 088f426986
commit 6c83169f1c
2 changed files with 11 additions and 3 deletions

View File

@ -59,12 +59,21 @@ class IDF_Form_ReviewCreate extends Pluf_Form
'rows' => 7,
),
));
$commits = Pluf::factory('IDF_Commit')->getList(array('order' => 'creation_dtime DESC',
'nb' => 10));
$choices = array();
foreach ($commits as $c) {
$id = (strlen($c->scm_id) > 10) ? substr($c->scm_id, 0, 10) : $c->scm_id;
$ext = (mb_strlen($c->summary) > 50) ? mb_substr($c->summary, 0, 47).'...' : $c->summary;
$choices[$id.' - '.$ext] = $c->scm_id;
}
$this->fields['commit'] = new Pluf_Form_Field_Varchar(
array('required' => true,
'label' => __('Commit'),
'initial' => '',
'widget' => 'Pluf_Form_Widget_SelectInput',
'widget_attrs' => array(
'size' => 42,
'choices' => $choices,
),
));
$upload_path = Pluf::f('upload_issue_path', false);

View File

@ -208,7 +208,6 @@ class IDF_Views_Review
$reviewers = array();
foreach ($diff->files as $filename => $def) {
$fileinfo = $scm->getFileInfo($filename, $patch->get_commit()->scm_id);
$sql = new Pluf_SQL('cfile=%s', array($filename));
$cts = $patch->get_filecomments_list(array('filter'=>$sql->gen(),
'order'=>'creation_dtime ASC'));
@ -216,7 +215,7 @@ class IDF_Views_Review
$reviewers[] = $ct->get_submitter();
}
if (count($def['chunks'])) {
$orig_file = $scm->getBlob($fileinfo);
$orig_file = ($fileinfo) ? $scm->getBlob($fileinfo) : '';
$files[$filename] = array(
$diff->fileCompare($orig_file, $def, $filename),
$form->f->{md5($filename)},