Skip to content

Commit 1811ed9

Browse files
authored
Merge pull request #71 from topcoder-platform/issues-490
Issues-476: fixed challenge roles after updating comments
2 parents fd0cffc + 3c96c92 commit 1811ed9

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Topcoder/class.topcoder.plugin.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,16 +852,25 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
852852
$groupID = $category->GroupID;
853853
}
854854
}
855-
} else if($args['Controller'] instanceof Groupcontroller) {
855+
} else if($args['Controller'] instanceof GroupController) {
856856
if (array_key_exists('groupid', $methodArgs)) {
857857
$groupID = (int) $methodArgs['groupid'];
858858
}
859+
} else if($args['Controller'] instanceof PostController) {
860+
if (array_key_exists('commentid', $methodArgs)) {
861+
$commentID = $methodArgs['commentid'];
862+
$commentModel = new CommentModel();
863+
$comment = $commentModel->getID($commentID);
864+
$discussionModel = new DiscussionModel();
865+
$discussion = $discussionModel->getID($comment->DiscussionID);
866+
if($discussion->CategoryID){
867+
$categoryModel = new CategoryModel();
868+
$category = $categoryModel->getID($discussion->CategoryID);
869+
$groupID = $category->GroupID;
870+
}
871+
}
859872
}
860-
//} else if($args instanceof CategoriesController) {
861-
//TODO
862-
//} else if ( $args instanceof CategoryController) {
863-
//TODO
864-
//}
873+
865874
if($groupID && $groupID > 0) {
866875
$groupModel = new GroupModel();
867876
$group = $groupModel->getByGroupID($groupID);

0 commit comments

Comments
 (0)