Skip to content

Commit

Permalink
#211 - removed the custom logic from ArticleController::doPUT() for s…
Browse files Browse the repository at this point in the history
…aving an existing comment
  • Loading branch information
alphadevx committed Sep 14, 2015
1 parent 10513b3 commit 7d954c4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
25 changes: 0 additions & 25 deletions Alpha/Controller/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,31 +338,6 @@ public function doPUT($request)
$viewState->set('markdownTextBoxRows', $params['markdownTextBoxRows']);
}

// save an existing comment
// TODO: move to dedicated controller, or use generic Create::doPUT().
if (isset($params['article_comment_id'])) {
$comment = new ArticleComment();

try {
$comment->load($params['article_comment_id']);

// re-populates the old object from post data
$comment->populateFromArray($params);

$success = $comment->save();

self::$logger->action('Updated the comment ['.$params['article_comment_id'].'] on the article ['.$record->getOID().']');

ActiveRecord::disconnect();

$this->setStatusMessage(View::displayUpdateMessage('Your comment has been updated.'));

return $this->doGET($request);
} catch (AlphaException $e) {
self::$logger->error($e->getMessage());
}
}

if (isset($params['title'])) {
$title = str_replace($config->get('cms.url.title.separator'), ' ', $params['title']);

Expand Down
2 changes: 1 addition & 1 deletion Alpha/View/ArticleCommentView.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function editView($fields = array())

$fieldname = ($config->get('security.encrypt.http.fieldnames') ? base64_encode(SecurityUtils::encrypt('version_num')) : 'version_num');
$html .= '<input type="hidden" name="'.$fieldname.'" value="'.$this->BO->getVersion().'"/>';
$fieldname = ($config->get('security.encrypt.http.fieldnames') ? base64_encode(SecurityUtils::encrypt('article_comment_id')) : 'article_comment_id');
$fieldname = ($config->get('security.encrypt.http.fieldnames') ? base64_encode(SecurityUtils::encrypt('ActiveRecordOID')) : 'ActiveRecordOID');
$html .= '<input type="hidden" name="'.$fieldname.'" value="'.$this->BO->getID().'"/>';

// render special buttons for admins only
Expand Down

0 comments on commit 7d954c4

Please sign in to comment.