Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions vanilla/applications/vanilla/views/discussion/helper_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ function writeComment($comment, $sender, $session, $currentOffset) {
$sender->EventArguments['Type'] = 'Comment';

// First comment template event
$sender->fireEvent('BeforeCommentDisplay'); ?>
$sender->fireEvent('BeforeCommentDisplay');

// FIX: https://github.com/topcoder-platform/forums/issues/488:
// ViewMode should be set before displaying comment
$viewMode = $sender->data('ViewMode');
?>
<li class="<?php echo $cssClass; ?>" id="<?php echo 'Comment_'.$comment->CommentID; ?>">
<div class="Comment">

Expand Down Expand Up @@ -144,18 +149,24 @@ function writeComment($comment, $sender, $session, $currentOffset) {
</span>
<span class="DiscussionInfo right">
<?php
$discussionName = 'Re: '. val('Name', $sender->data('Discussion'));
$parentCommentID = $comment->ParentCommentID;
if($parentCommentID) {
$commentModel = new CommentModel();
$parentComment = $commentModel->getID($parentCommentID);
$parentCommentPermalink = '/discussion/comment/' . $parentCommentID . '/#Comment_' . $parentCommentID;
$parentCommentAuthor = Gdn::userModel()->getID($parentComment->InsertUserID);
$parentCommentAuthor = userAnchor($parentCommentAuthor);
$post = anchor('post', $parentCommentPermalink, 'ParentComment');
echo ''. wrapIf($discussionName . ' (response to '.$post.' by '.$parentCommentAuthor.')', 'span', ['class' => '']);
} else {
echo ''. wrapIf($discussionName, 'span', ['class' => '']);
if($viewMode == 'flat') {
$discussionName = 'Re: ' . val('Name', $sender->data('Discussion'));
$parentCommentID = $comment->ParentCommentID;
if ($parentCommentID) {
$commentModel = new CommentModel();
$parentComment = $commentModel->getID($parentCommentID);
$parentCommentPermalink = '/discussion/comment/' . $parentCommentID . '/?view='.$viewMode.'#Comment_' . $parentCommentID;
$parentCommentAuthor = Gdn::userModel()->getID($parentComment->InsertUserID);
$post = anchor('post', $parentCommentPermalink, 'ParentCommentLink');
echo '' . wrapIf($discussionName . ' (response to ' . $post . ' by ' .userAnchor($parentCommentAuthor) . ')', 'span', ['class' => '']);
} else {
$discussion = $sender->data('Discussion');
$discussionPermalink = discussionUrl($discussion).'?view='.$viewMode;
$discussionAuthor = Gdn::userModel()->getID($discussion->InsertUserID);
//echo '' . wrapIf($discussionName, 'span', ['class' => '']);
$post = anchor('post', $discussionPermalink, 'DiscussionLink');
echo '' . wrapIf($discussionName . ' (response to ' . $post . ' by ' . userAnchor($discussionAuthor) . ')', 'span', ['class' => '']);
}
}
?>
</span>
Expand Down
13 changes: 7 additions & 6 deletions vanilla/applications/vanilla/views/post/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@
$CancelClass = 'Cancel';
}

echo '<span class="'.$CancelClass.'">';
echo anchor($CancelText, '/');
if ($this->data('Editor.BackLink')) {
echo ' <span class="Bullet">•</span> '.$this->data('Editor.BackLink') ;
}
echo '</span>';
// FIX: https://github.com/topcoder-platform/forums/issues/488
// echo '<span class="'.$CancelClass.'">';
// echo anchor($CancelText, '/');
// if ($this->data('Editor.BackLink')) {
// echo ' <span class="Bullet">•</span> '.$this->data('Editor.BackLink') ;
// }
// echo '</span>';

$ButtonOptions = ['class' => 'Button Primary CommentButton'];
$ButtonOptions['tabindex'] = 1;
Expand Down