From 8428acc29079510b41c1640ac754f597192f98d5 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sun, 4 Apr 2021 18:29:17 +0300 Subject: [PATCH] Issues-527: Made tcadmin handle unclickable --- Topcoder/class.topcoder.plugin.php | 15 +++++++++++++-- Topcoder/design/topcoder.css | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index 0d11db4..d3a648a 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -1892,6 +1892,10 @@ private static function topcoderUserTopcoderCache($userFields) { return $cached; } + public static function isUnclickableUser($userName) { + return strtolower($userName) == 'tcadmin'; + } + public static function log($message, $data = []) { if (c('Vanilla.SSO.Debug') || c('Debug')) { Logger::event( @@ -2046,7 +2050,8 @@ function userPhoto($user, $options = []) { $isTopcoderAdmin = val('IsAdmin', $topcoderProfile); $photoUrl = isset($photoUrl) && !empty(trim($photoUrl)) ? $photoUrl: UserModel::getDefaultAvatarUrl(); - $href = (val('NoLink', $options)) ? '' : ' href="'.url($userLink).'"'; + $isUnlickableUser = TopcoderPlugin::isUnclickableUser($name); + $href = (val('NoLink', $options)) || $isUnlickableUser ? '' : ' href="'.url($userLink).'"'; Gdn::controller()->EventArguments['User'] = $user; Gdn::controller()->EventArguments['Title'] =& $title; @@ -2136,7 +2141,8 @@ function userAnchor($user, $cssClass = null, $options = null) { } // Go to Topcoder user profile link instead of Vanilla profile link - $userUrl = topcoderUserUrl($user, $px); + $isUnlickableUser = TopcoderPlugin::isUnclickableUser($name); + $userUrl = $isUnlickableUser? '#' : topcoderUserUrl($user, $px); $topcoderProfile = TopcoderPlugin::getTopcoderUser($userID); $topcoderRating = val('Rating',$topcoderProfile, false); @@ -2150,6 +2156,11 @@ function userAnchor($user, $cssClass = null, $options = null) { $attributes['class'] = $attributes['class'].' '. 'topcoderAdmin' ; } + if($isUnlickableUser) { + $attributes['class'] = $attributes['class'].' '. 'disabledLink' ; + } + + Gdn::controller()->EventArguments['User'] = $user; Gdn::controller()->EventArguments['IsTopcoderAdmin'] =$isTopcoderAdmin; Gdn::controller()->EventArguments['Text'] =& $text; diff --git a/Topcoder/design/topcoder.css b/Topcoder/design/topcoder.css index 333e0f7..55d950b 100644 --- a/Topcoder/design/topcoder.css +++ b/Topcoder/design/topcoder.css @@ -159,4 +159,8 @@ a:hover span.challengeRoles { font-weight: 500 !important; line-height: 38px !important; text-transform: uppercase !important; +} + +.disabledLink { + pointer-events:none } \ No newline at end of file