Skip to content

Commit 658bcee

Browse files
committed
Issues-476:Show Copilot/Reviewer roles and hide other challenge roles
1 parent 858f988 commit 658bcee

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

class.groups.plugin.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,15 @@ private function getMediaData($type, $id) {
746746
public function base_userAnchor_handler($sender, $args){
747747
if($sender instanceof DiscussionController || $sender instanceof GroupController) {
748748
$user = $args['User'];
749+
$isTopcoderAdmin = $args['IsTopcoderAdmin'];
749750
$anchorText = &$args['Text'];
750751
$resources = $sender->data('ChallengeResources');
751752
$roleResources = $sender->data('ChallengeRoleResources');
752-
$anchorText = $anchorText . $this->topcoderProjectRolesText($user, $resources, $roleResources);
753+
$anchorText = '<span class="topcoderHandle">'.$anchorText.'</span>';
754+
// Don't show Topcoder Challenge roles for admin roles
755+
if(!$isTopcoderAdmin){
756+
$anchorText = $anchorText . $this->topcoderProjectRolesText($user, $resources, $roleResources);
757+
}
753758
}
754759
}
755760

@@ -764,14 +769,14 @@ public function base_userPhoto_handler($sender, $args){
764769
$anchorText = &$args['Title'];
765770
$resources = $sender->data('ChallengeResources');
766771
$roleResources = $sender->data('ChallengeRoleResources');
767-
$anchorText = $anchorText . $this->topcoderProjectRolesText($user, $resources, $roleResources);
768772
}
769773
}
770774

771775
private function topcoderProjectRolesText($user, $resources = null, $roleResources = null) {
772776
$roles = $this->getTopcoderProjectRoles($user, $resources, $roleResources);
773-
return count($roles) > 0 ? '(' . implode(', ', $roles) . ')' : '';
774-
777+
// FIX: https://github.com/topcoder-platform/forums/issues/476: Show only Copilot, Reviewer roles
778+
$displayedRoles = array_intersect(array_unique($roles), ["Copilot", "Reviewer"]);
779+
return count($displayedRoles) > 0 ? ' <span class="challengeRoles">(' . implode(', ', $displayedRoles) . ')</span>' : '';
775780
}
776781

777782
/**

0 commit comments

Comments
 (0)