@@ -106,7 +106,12 @@ function writeComment($comment, $sender, $session, $currentOffset) {
106
106
$ sender ->EventArguments ['Type ' ] = 'Comment ' ;
107
107
108
108
// First comment template event
109
- $ sender ->fireEvent ('BeforeCommentDisplay ' ); ?>
109
+ $ sender ->fireEvent ('BeforeCommentDisplay ' );
110
+
111
+ // FIX: https://github.com/topcoder-platform/forums/issues/488:
112
+ // ViewMode should be set before displaying comment
113
+ $ viewMode = $ sender ->data ('ViewMode ' );
114
+ ?>
110
115
<li class="<?php echo $ cssClass ; ?> " id="<?php echo 'Comment_ ' .$ comment ->CommentID ; ?> ">
111
116
<div class="Comment">
112
117
@@ -144,18 +149,24 @@ function writeComment($comment, $sender, $session, $currentOffset) {
144
149
</span>
145
150
<span class="DiscussionInfo right">
146
151
<?php
147
- $ discussionName = 'Re: ' . val ('Name ' , $ sender ->data ('Discussion ' ));
148
- $ parentCommentID = $ comment ->ParentCommentID ;
149
- if ($ parentCommentID ) {
150
- $ commentModel = new CommentModel ();
151
- $ parentComment = $ commentModel ->getID ($ parentCommentID );
152
- $ parentCommentPermalink = '/discussion/comment/ ' . $ parentCommentID . '/#Comment_ ' . $ parentCommentID ;
153
- $ parentCommentAuthor = Gdn::userModel ()->getID ($ parentComment ->InsertUserID );
154
- $ parentCommentAuthor = userAnchor ($ parentCommentAuthor );
155
- $ post = anchor ('post ' , $ parentCommentPermalink , 'ParentComment ' );
156
- echo '' . wrapIf ($ discussionName . ' (response to ' .$ post .' by ' .$ parentCommentAuthor .') ' , 'span ' , ['class ' => '' ]);
157
- } else {
158
- echo '' . wrapIf ($ discussionName , 'span ' , ['class ' => '' ]);
152
+ if ($ viewMode == 'flat ' ) {
153
+ $ discussionName = 'Re: ' . val ('Name ' , $ sender ->data ('Discussion ' ));
154
+ $ parentCommentID = $ comment ->ParentCommentID ;
155
+ if ($ parentCommentID ) {
156
+ $ commentModel = new CommentModel ();
157
+ $ parentComment = $ commentModel ->getID ($ parentCommentID );
158
+ $ parentCommentPermalink = '/discussion/comment/ ' . $ parentCommentID . '/?view= ' .$ viewMode .'#Comment_ ' . $ parentCommentID ;
159
+ $ parentCommentAuthor = Gdn::userModel ()->getID ($ parentComment ->InsertUserID );
160
+ $ post = anchor ('post ' , $ parentCommentPermalink , 'ParentCommentLink ' );
161
+ echo '' . wrapIf ($ discussionName . ' (response to ' . $ post . ' by ' .userAnchor ($ parentCommentAuthor ) . ') ' , 'span ' , ['class ' => '' ]);
162
+ } else {
163
+ $ discussion = $ sender ->data ('Discussion ' );
164
+ $ discussionPermalink = discussionUrl ($ discussion ).'?view= ' .$ viewMode ;
165
+ $ discussionAuthor = Gdn::userModel ()->getID ($ discussion ->InsertUserID );
166
+ //echo '' . wrapIf($discussionName, 'span', ['class' => '']);
167
+ $ post = anchor ('post ' , $ discussionPermalink , 'DiscussionLink ' );
168
+ echo '' . wrapIf ($ discussionName . ' (response to ' . $ post . ' by ' . userAnchor ($ discussionAuthor ) . ') ' , 'span ' , ['class ' => '' ]);
169
+ }
159
170
}
160
171
?>
161
172
</span>
0 commit comments