@@ -71,7 +71,7 @@ public function postController_render_before($sender) {
71
71
* @param $sender
72
72
* @param $args
73
73
*/
74
- public function base_Replies_handler ($ sender , $ args ){
74
+ public function base_InlineDiscussionOptionsLeft_handler ($ sender , $ args ){
75
75
$ discussion = $ sender ->data ('Discussion ' );
76
76
if (!$ discussion ) {
77
77
return ;
@@ -84,10 +84,44 @@ public function base_Replies_handler($sender, $args){
84
84
$ discussionUrl = discussionUrl ($ discussion , '' , '/ ' );
85
85
$ viewMode = self ::getViewMode ();
86
86
87
- echo '<div class="ReplyViewOptions"><span class="MLabel">View: </span> ' ;
88
- echo anchor ('Threaded ' , $ discussionUrl .'? ' .self ::QUERY_PARAMETER_VIEW .'= ' .self ::VIEW_THREADED , $ viewMode == self ::VIEW_THREADED ?'Active ' :'' ).' | ' ;
89
- echo anchor ('Flat ' , $ discussionUrl .'? ' .self ::QUERY_PARAMETER_VIEW .'= ' .self ::VIEW_FLAT , $ viewMode == self ::VIEW_FLAT ?'Active ' :'' );
90
- echo '</div> ' ;
87
+ echo '<span class="ReplyViewOptions"> ' ;
88
+ echo '<span class="MLabel">View: </span> ' ;
89
+ echo anchor ('Threaded ' , $ discussionUrl .'? ' .self ::QUERY_PARAMETER_VIEW .'= ' .self ::VIEW_THREADED , $ viewMode == self ::VIEW_THREADED ?'ReplyViewOptionLink Active ' :'ReplyViewOptionLink ' ).' | ' ;
90
+ echo anchor ('Flat ' , $ discussionUrl .'? ' .self ::QUERY_PARAMETER_VIEW .'= ' .self ::VIEW_FLAT , $ viewMode == self ::VIEW_FLAT ?'ReplyViewOptionLink Active ' :'ReplyViewOptionLink ' );
91
+ echo '</span> ' ;
92
+ }
93
+
94
+ public function base_inlineCommentOptionsRight_handler ($ sender , $ args ) {
95
+ ReplyToPlugin::log ('base_inlineCommentOptionsRight_handler ' , []);
96
+
97
+ if (!Gdn::Session ()->isValid ()) {
98
+ return ;
99
+ }
100
+
101
+ $ discussion = $ sender ->data ('Discussion ' );
102
+ $ isClosed = ((int )$ discussion ->Closed ) == 1 ;
103
+ if ($ isClosed ) {
104
+ return ;
105
+ }
106
+
107
+ //Check permission
108
+ $ CategoryID = val ('PermissionCategoryID ' , $ discussion ) ? val ('PermissionCategoryID ' , $ discussion ) : val ('CategoryID ' , $ discussion );
109
+
110
+ // Can the user comment on this category, and is the discussion open for comments?
111
+ if (!Gdn::Session ()->CheckPermission ('Vanilla.Comments.Add ' , TRUE , 'Category ' , $ CategoryID )) {
112
+ return ;
113
+ }
114
+
115
+ $ viewMode = self ::getViewMode ();
116
+ $ comment = &$ args ['Comment ' ];
117
+ $ items = & $ args ['Items ' ];
118
+ $ commentID = val ('CommentID ' , $ comment );
119
+ if (empty ($ items )) {
120
+ $ items = [];
121
+ }
122
+ array_push ( $ items , anchor (
123
+ t ('Reply ' ),
124
+ url ("/?ParentCommentID= " .$ commentID ."&view= " .$ viewMode , false ), 'ReplyComment ' ));
91
125
}
92
126
93
127
/**
@@ -208,6 +242,7 @@ public function base_commentOptions_handler($sender, $args) {
208
242
return ;
209
243
}
210
244
245
+ /*
211
246
$options = &$args['CommentOptions'];
212
247
$comment = &$args['Comment'];
213
248
$options['ReplyToComment'] = [
@@ -229,6 +264,7 @@ public function base_commentOptions_handler($sender, $args) {
229
264
$options[$key]['Url'] = $currentUrl.'?view='.$viewMode;
230
265
}
231
266
}
267
+ */
232
268
}
233
269
234
270
/**
0 commit comments