Skip to content
Snippets Groups Projects
Commit a930d64f authored by Roger Feese's avatar Roger Feese
Browse files

Merge branch 'projects-task-87' into 'master'

Projects task 87

Added more checks for existence of files when loading request history notes. This should fix the error that is appearing in this task and on other cases where creq major names have changed. It does not completely fix the problem as the history on old revisions before a name change is not visible. It also does not fix the problem of missing notes.

See merge request !30
parents 7dad8c3f 4d986aa8
Branches
No related tags found
No related merge requests found
......@@ -146,22 +146,26 @@ class Bulletin_ViewController extends Requests_ViewController
$parentCommit = $repo->getParentCommitForSection($section);
$contents = $repo->getFileNotes(
'/data/' . $repo->getFilePathForSection($section), $parentCommit
);
$originalFileContents = $repo->getFileContents('/data/' . $repo->getFilePathForSection($section), $parentCommit);
// Original file content
$originalFileContents = "";
$originalFilePath = $repo->getFilePathForSection($section);
// Only attempt to get notes if getFilePathForSection actually returns a value
if(!empty($originalFilePath)){
$originalFileContents = $repo->getFileContents('/data/' . $originalFilePath, $parentCommit);
$originalFileContents = Bulletin_SectionModel::getBodyHtml($originalFileContents);
//$originalFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::format($originalFileContents);
$originalFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($originalFileContents);
}
$requestOriginalFileContents[$request->getId()] = $originalFileContents;
$proposedFileContents = $repo->getFileNotes(
'/data/' . $repo->getFilePathForSection($section), 'request-' . $request->getId()
);
// Proposed file content
$proposedFileContents = "";
$proposedFilePath = $repo->getFilePathForSection($section);
// Only attempt to get notes if getFilePathForSection actually returns a value
if(!empty($proposedFilePath)){
$proposedFileContents = $repo->getFileNotes('/data/' . $proposedFilePath, 'request-' . $request->getId());
$proposedFileContents = Bulletin_SectionModel::getBodyHtml($proposedFileContents);
//$proposedFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::format($proposedFileContents);
$proposedFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($proposedFileContents);
}
$requestProposedFileContents[$request->getId()] = $proposedFileContents;
}
......
......@@ -67,7 +67,8 @@ class Bulletin_RepositoryModel
$filepath = $this->_repoPath . '/' . $path;
$this->_checkout($branch);
if(file_exists($filepath)){
//make sure path exists and it is a file
if(file_exists($filepath) && is_file($filepath)){
$this->_git_exec('hash-object ' . escapeshellarg($filepath), $object);
$this->_git_exec('notes --ref=creq show ' . escapeshellarg($object), $note);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment