Skip to content
Snippets Groups Projects
Commit 8133244e authored by Nick Barry's avatar Nick Barry
Browse files

Merge branch 'fix-bulletin-view-missing-notes-error' into 'master'

Fix bulletin view missing notes error

Fixed a few types of errors that can occur when viewing bulletin sections where the creq is trying to lookup git notes.

See merge request !27
parents f1c06ff1 9fae204f
Branches
Tags
No related merge requests found
...@@ -149,18 +149,20 @@ class Bulletin_ViewController extends Requests_ViewController ...@@ -149,18 +149,20 @@ class Bulletin_ViewController extends Requests_ViewController
$contents = $repo->getFileNotes( $contents = $repo->getFileNotes(
'/data/' . $repo->getFilePathForSection($section), $parentCommit '/data/' . $repo->getFilePathForSection($section), $parentCommit
); );
$contents = Bulletin_SectionModel::getBodyHtml($contents);
//$contents = UNL_UndergraduateBulletin_EPUB_Utilities::format($contents);
$contents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($contents);
$requestOriginalFileContents[$request->getId()] = $contents;
$contents = $repo->getFileNotes( $originalFileContents = $repo->getFileContents('/data/' . $repo->getFilePathForSection($section), $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() '/data/' . $repo->getFilePathForSection($section), 'request-' . $request->getId()
); );
$contents = Bulletin_SectionModel::getBodyHtml($contents); $proposedFileContents = Bulletin_SectionModel::getBodyHtml($proposedFileContents);
//$contents = UNL_UndergraduateBulletin_EPUB_Utilities::format($contents); //$proposedFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::format($proposedFileContents);
$contents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($contents); $proposedFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($proposedFileContents);
$requestProposedFileContents[$request->getId()] = $contents; $requestProposedFileContents[$request->getId()] = $proposedFileContents;
} }
$this->view->requests = $requests; $this->view->requests = $requests;
......
...@@ -64,10 +64,13 @@ class Bulletin_RepositoryModel ...@@ -64,10 +64,13 @@ class Bulletin_RepositoryModel
public function getFileNotes($path, $branch = 'master') public function getFileNotes($path, $branch = 'master')
{ {
$object = $note = ''; $object = $note = '';
$filepath = $this->_repoPath . '/' . $path;
$this->_checkout($branch); $this->_checkout($branch);
$this->_git_exec('hash-object ' . escapeshellarg($this->_repoPath . '/' . $path), $object); if(file_exists($filepath)){
$this->_git_exec('hash-object ' . escapeshellarg($filepath), $object);
$this->_git_exec('notes --ref=creq show ' . escapeshellarg($object), $note); $this->_git_exec('notes --ref=creq show ' . escapeshellarg($object), $note);
}
$this->_checkout('master'); $this->_checkout('master');
return $note; return $note;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment