Skip to content

Commit a8dbd79

Browse files
committed
Issues-476: Fixed challenge roles for new comments
1 parent 70cb0e3 commit a8dbd79

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Topcoder/class.topcoder.plugin.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,12 @@ public function userController_UserCell_handler($sender, $args) {
827827
<?php
828828
}
829829

830+
/**
831+
* Load resource roles and challenge roles by challengeID from Topcoder services
832+
* and set data to sender.
833+
* @param $sender
834+
* @param $args
835+
*/
830836
function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
831837
if(!c('Garden.Installed')){
832838
return;
@@ -857,7 +863,16 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
857863
$groupID = (int) $methodArgs['groupid'];
858864
}
859865
} else if($args['Controller'] instanceof PostController) {
860-
if (array_key_exists('commentid', $methodArgs)) {
866+
if (array_key_exists('discussionid', $methodArgs)) {
867+
$discussionID = $methodArgs['discussionid'];
868+
$discussionModel = new DiscussionModel();
869+
$discussion = $discussionModel->getID($discussionID);
870+
if($discussion->CategoryID){
871+
$categoryModel = new CategoryModel();
872+
$category = $categoryModel->getID($discussion->CategoryID);
873+
$groupID = $category->GroupID;
874+
}
875+
} else if (array_key_exists('commentid', $methodArgs)) {
861876
$commentID = $methodArgs['commentid'];
862877
$commentModel = new CommentModel();
863878
$comment = $commentModel->getID($commentID);

0 commit comments

Comments
 (0)