From f565ce153af01acf3e5c77077479b9ac354304db Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Wed, 17 Mar 2021 20:32:30 +0300 Subject: [PATCH 01/16] Add endpoints to get user permissions --- .../api/PermissionApiController.php | 67 +++++++++++++++++++ DebugPlugin/openapi/permission.yml | 52 ++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 DebugPlugin/controllers/api/PermissionApiController.php create mode 100644 DebugPlugin/openapi/permission.yml diff --git a/DebugPlugin/controllers/api/PermissionApiController.php b/DebugPlugin/controllers/api/PermissionApiController.php new file mode 100644 index 0000000..5e4a380 --- /dev/null +++ b/DebugPlugin/controllers/api/PermissionApiController.php @@ -0,0 +1,67 @@ +permission('Garden.Settings.Manage'); + if (!Gdn::userModel()->getID($userID)) { + throw notFoundException('User'); + } + $userPermissions = Gdn::userModel()->getPermissions($userID); + $data = [ + 'userPermissions' => $userPermissions, + ]; + return $data; + } + + /** + * Get user permissions for a category + * @param $userID + * @param $categoryID + * @return Data + * @throws \Garden\Web\Exception\HttpException + * @throws \Vanilla\Exception\PermissionException + */ + public function get($userID, $categoryID) { + $this->permission('Garden.Settings.Manage'); + + if (!Gdn::userModel()->getID($userID)) { + throw notFoundException('User'); + } + + $category = CategoryModel::categories($categoryID); + if (!$category) { + throw notFoundException('Category'); + } + $groupID = val('GroupID', $category, null); + $data = [ + 'GroupID' => $groupID, + 'PermsGroupView' => $groupID? GroupModel::getGroupRoleFor($userID, $groupID) : null, + 'PermsDiscussionsView' => CategoryModel::checkPermission($category, 'Vanilla.Discussions.View', true, $userID), + 'PermsDiscussionsAdd' => CategoryModel::checkPermission($category, 'Vanilla.Discussions.Add', true, $userID), + 'PermsDiscussionsEdit' => CategoryModel::checkPermission($category, 'Vanilla.Discussions.Edit', true, $userID), + 'PermsCommentsAdd' => CategoryModel::checkPermission($category, 'Vanilla.Comments.Add', true, $userID), + 'PermsDiscussionsUploads' => CategoryModel::checkPermission($category, 'Vanilla.Discussions.Uploads', true, $userID), + 'PermsCommentsUploads' => CategoryModel::checkPermission($category, 'Vanilla.Comments.Uploads', true, $userID) + ]; + return $data; + } +} \ No newline at end of file diff --git a/DebugPlugin/openapi/permission.yml b/DebugPlugin/openapi/permission.yml new file mode 100644 index 0000000..63c826a --- /dev/null +++ b/DebugPlugin/openapi/permission.yml @@ -0,0 +1,52 @@ +openapi: 3.0.2 +info: Vanilla Permission API +paths: + /permission/{userID}/{categoryID}: + get: + parameters: + - description: UserID to check. + in: path + name: userID + schema: + type: integer + - description: CategoryID to check. + in: path + name: categoryID + schema: + type: integer + responses: + '200': + content: + 'application/json': + schema: + items: + $ref: '#/components/schemas/Records' + type: array + description: Success + tags: + - Data + summary: List records. + /permission/{userID}: + get: + parameters: + - description: UserID to check. + in: path + name: userID + schema: + type: integer + responses: + '200': + content: + 'application/json': + schema: + items: + $ref: '#/components/schemas/Records' + type: array + description: Success + tags: + - Data + summary: List records. +components: + schemas: + Records: + type: object \ No newline at end of file From c2edfbfb040d623f005c0ff60e7d11245d4b9ca5 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Wed, 17 Mar 2021 20:33:42 +0300 Subject: [PATCH 02/16] Add endpoints to get user permissions --- DebugPlugin/controllers/api/PermissionApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebugPlugin/controllers/api/PermissionApiController.php b/DebugPlugin/controllers/api/PermissionApiController.php index 5e4a380..dd47f1d 100644 --- a/DebugPlugin/controllers/api/PermissionApiController.php +++ b/DebugPlugin/controllers/api/PermissionApiController.php @@ -9,7 +9,7 @@ use Vanilla\ApiUtils; /** - * SQL API Controller for the `/sql` resource. + * Permission API Controller for the `/permission` resource. */ class PermissionApiController extends AbstractApiController { From 76c35a7fcbb90110033156feb8e9bc0bc1abd7d2 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Wed, 24 Mar 2021 13:32:58 +0300 Subject: [PATCH 03/16] Issues-476:Show Copilot/Reviewer roles and hide other challenge roles --- Topcoder/class.topcoder.plugin.php | 1 + Topcoder/design/topcoder.css | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index baf8093..557519a 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -2125,6 +2125,7 @@ function userAnchor($user, $cssClass = null, $options = null) { } Gdn::controller()->EventArguments['User'] = $user; + Gdn::controller()->EventArguments['IsTopcoderAdmin'] =$isTopcoderAdmin; Gdn::controller()->EventArguments['Text'] =& $text; Gdn::controller()->EventArguments['Attributes'] =& $attributes; Gdn::controller()->fireEvent('UserAnchor'); diff --git a/Topcoder/design/topcoder.css b/Topcoder/design/topcoder.css index 8b6e4b0..e91081c 100644 --- a/Topcoder/design/topcoder.css +++ b/Topcoder/design/topcoder.css @@ -42,10 +42,10 @@ a.coderRatingRed:hover, a.coderRatingYellow:hover, a.coderRatingBlue:hover, a.co text-decoration: none !important; } .coderRatingRed:hover, .coderRatingYellow:hover, .coderRatingBlue:hover, .coderRatingGreen:hover, .coderRatingGrey:hover, .coderRatingNone:hover, .topcoderAdmin:hover { - text-decoration: underline !important; + text-decoration: none !important; } .coderRatingRed:active, .coderRatingYellow:active, .coderRatingBlue:active, .coderRatingGreen:active, .coderRatingGrey:active, .coderRatingNone:active, .topcoderAdmin:active { - text-decoration: underline !important; + text-decoration: none !important; } /* Red */ @@ -108,6 +108,18 @@ a.coderRatingRed:hover, a.coderRatingYellow:hover, a.coderRatingBlue:hover, a.co .Flyout.Flyout a.topcoderAdmin, .Flyout.Flyout a.topcoderAdmin:link,.Flyout.Flyout a.topcoderAdmin:visited, .Flyout.Flyout a.topcoderAdmin:hover, .Flyout.Flyout a.topcoderAdmin:active, .userContent p a.topcoderAdmin, .userContent p a.topcoderAdmin:link, .userContent p a.topcoderAdmin:visited, .userContent p a.topcoderAdmin:hover, .userContent p a.topcoderAdmin:active { color: #ff9900 !important; } +a:hover span.topcoderHandle{ + text-decoration: underline; +} + +a span.challengeRoles { + color: black; +} + +a:hover span.challengeRoles { + text-decoration: underline; +} + /* Search breadcrumbs css style */ .Media-Location .Breadcrumbs { From fad4ce92ca6963ed5c8331922481db0762342096 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Thu, 25 Mar 2021 12:16:21 +0300 Subject: [PATCH 04/16] Issues-395: treaded view is used by default, removed tree view option --- ReplyTo/class.replyto.plugin.php | 66 ++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/ReplyTo/class.replyto.plugin.php b/ReplyTo/class.replyto.plugin.php index fd402a3..530fafb 100644 --- a/ReplyTo/class.replyto.plugin.php +++ b/ReplyTo/class.replyto.plugin.php @@ -9,7 +9,6 @@ class ReplyToPlugin extends Gdn_Plugin { const QUERY_PARAMETER_VIEW='view'; const VIEW_FLAT = 'flat'; - const VIEW_TREE = 'tree'; const VIEW_THREADED = 'threaded'; private $replyToModel; @@ -83,12 +82,11 @@ public function base_Replies_handler($sender, $args){ } $discussionUrl = discussionUrl($discussion, '', '/'); - $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW, self::VIEW_FLAT); + $viewMode = self::getViewMode(); echo '
View: '; - echo anchor('Flat', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_FLAT, $viewMode == self::VIEW_FLAT?'Active':'').'  |  '; echo anchor('Threaded', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_THREADED, $viewMode == self::VIEW_THREADED?'Active':'').'  |  '; - echo anchor('Tree', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_TREE, $viewMode == self::VIEW_TREE?'Active':''); + echo anchor('Flat', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_FLAT, $viewMode == self::VIEW_FLAT?'Active':''); echo '
'; } @@ -98,9 +96,9 @@ public function base_Replies_handler($sender, $args){ * @param $sender */ public function commentModel_afterConstruct_handler(&$sender) { - self::log('commentModel_afterConstruct_handler', ['path'=> Gdn::request()->pathAndQuery()]); - $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW, self::VIEW_FLAT); - if($viewMode == self::VIEW_TREE || $viewMode == self::VIEW_THREADED) { + $viewMode = self::getViewMode(); + + if($viewMode == self::VIEW_THREADED) { $sender->orderBy(array('TreeLeft asc', 'DateInserted asc')); } } @@ -138,10 +136,8 @@ public function discussionController_BeforeCalculatingOffsetLimit_handler($sende if (!Gdn::session()->isValid()) { return; } - $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW); - if(!$viewMode) { - return; - } + $viewMode = self::getViewMode(); + // $offsetProvided = $args['OffsetProvided']; $discussion = $args['Discussion']; $offset = & $args['Offset']; $limit = & $args['Limit']; @@ -152,7 +148,6 @@ public function discussionController_BeforeCalculatingOffsetLimit_handler($sende } if($viewMode === self::VIEW_FLAT) { - $offset = 0; $enableAutoOffset = false; } else { // Show all comment on one offset for Tree/Threaded View @@ -176,7 +171,7 @@ public function discussionController_beforeDiscussionRender_handler($sender, $ar return; } - $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW, self::VIEW_FLAT); + $viewMode = self::getViewMode(); if($viewMode == self::VIEW_FLAT) { return; } @@ -221,7 +216,7 @@ public function base_commentOptions_handler($sender, $args) { 'Class' => 'ReplyComment' ]; - $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW, self::VIEW_FLAT); + $viewMode = self::getViewMode(); foreach ($options as $key => $value) { $currentUrl = $options[$key]['Url']; if (strpos($currentUrl, '?') !== false ) { @@ -242,20 +237,30 @@ public function base_commentOptions_handler($sender, $args) { * @param $args */ public function base_beforeCommentDisplay_handler($sender, $args) { - ReplyToPlugin::log('base_beforeCommentDisplay_handler', []); - - $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW, self::VIEW_FLAT); - if($viewMode == self::VIEW_FLAT) { - return; - } if($sender->deliveryType() != DELIVERY_TYPE_ALL) { - ReplyToPlugin::log('base_beforeCommentDisplay_handler', ['']); - $this->buildCommentReplyToCssClasses($sender); + if(isset($_SERVER['HTTP_REFERER'])) { + $previous = $_SERVER['HTTP_REFERER']; + $query = parse_url($previous, PHP_URL_QUERY); + parse_str($query, $params); + $viewMode = $params['view']; + if(!$viewMode) { + $viewMode = self::isPagingUrl($previous) ? self::VIEW_FLAT : self::VIEW_THREADED; + } + + if($viewMode == self::VIEW_THREADED) { + $this->buildCommentReplyToCssClasses($sender); + } + } + } else { + $viewMode = self::getViewMode(); + if($viewMode == self::VIEW_THREADED) { + $this->buildCommentReplyToCssClasses($sender); + } } $comment = &$args['Comment']; $cssClass = &$args['CssClass']; - $displayBody = &$args['DisplayBody']; - $displayBody = $viewMode == self::VIEW_FLAT || $viewMode == self::VIEW_THREADED; + // $displayBody = &$args['DisplayBody']; + // $displayBody = $viewMode == self::VIEW_FLAT || $viewMode == self::VIEW_THREADED; $cssClass .= (!empty($comment->ReplyToClass)? ' ' . $comment->ReplyToClass : ''); } @@ -330,6 +335,19 @@ private function buildCommentReplyToCssClasses(&$sender){ } } + private static function isPagingUrl($url) { + return preg_match('/\/p\d+$/', $url); + } + + private static function getViewMode(){ + $viewMode = getIncomingValue(self::QUERY_PARAMETER_VIEW); + if(!$viewMode) { + $viewMode = self::isPagingUrl(Gdn::request()->path())? self::VIEW_FLAT: self::VIEW_THREADED; + } + + return $viewMode; + } + public static function log($message, $data) { if (c('Debug')) { Logger::event( From ac2acb12a3c439c07728f19e1ac724539f091c82 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Thu, 25 Mar 2021 23:29:18 +0300 Subject: [PATCH 05/16] Issues-490: Move reply to comment block --- ReplyTo/class.replyto.plugin.php | 46 ++++++++++++++++++++++++++++---- ReplyTo/design/replyto.css | 5 +++- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ReplyTo/class.replyto.plugin.php b/ReplyTo/class.replyto.plugin.php index 530fafb..075e229 100644 --- a/ReplyTo/class.replyto.plugin.php +++ b/ReplyTo/class.replyto.plugin.php @@ -71,7 +71,7 @@ public function postController_render_before($sender) { * @param $sender * @param $args */ - public function base_Replies_handler($sender, $args){ + public function base_InlineDiscussionOptionsLeft_handler($sender, $args){ $discussion = $sender->data('Discussion'); if (!$discussion) { return; @@ -84,10 +84,44 @@ public function base_Replies_handler($sender, $args){ $discussionUrl = discussionUrl($discussion, '', '/'); $viewMode = self::getViewMode(); - echo '
View: '; - echo anchor('Threaded', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_THREADED, $viewMode == self::VIEW_THREADED?'Active':'').'  |  '; - echo anchor('Flat', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_FLAT, $viewMode == self::VIEW_FLAT?'Active':''); - echo '
'; + echo ''; + echo 'View: '; + echo anchor('Threaded', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_THREADED, $viewMode == self::VIEW_THREADED?'ReplyViewOptionLink Active':'ReplyViewOptionLink').'  |  '; + echo anchor('Flat', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_FLAT, $viewMode == self::VIEW_FLAT?'ReplyViewOptionLink Active':'ReplyViewOptionLink'); + echo ''; + } + + public function base_inlineCommentOptionsRight_handler($sender, $args) { + ReplyToPlugin::log('base_inlineCommentOptionsRight_handler', []); + + if (!Gdn::Session()->isValid()) { + return; + } + + $discussion = $sender->data('Discussion'); + $isClosed = ((int)$discussion->Closed) == 1; + if ($isClosed) { + return; + } + + //Check permission + $CategoryID = val('PermissionCategoryID', $discussion) ? val('PermissionCategoryID', $discussion) : val('CategoryID', $discussion); + + // Can the user comment on this category, and is the discussion open for comments? + if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) { + return; + } + + $viewMode = self::getViewMode(); + $comment = &$args['Comment']; + $items = & $args['Items']; + $commentID = val('CommentID', $comment); + if(empty($items)) { + $items = []; + } + array_push( $items, anchor( + t('Reply'), + url("/?ParentCommentID=".$commentID."&view=".$viewMode, false), 'ReplyComment')); } /** @@ -208,6 +242,7 @@ public function base_commentOptions_handler($sender, $args) { return; } + /* $options = &$args['CommentOptions']; $comment = &$args['Comment']; $options['ReplyToComment'] = [ @@ -229,6 +264,7 @@ public function base_commentOptions_handler($sender, $args) { $options[$key]['Url'] = $currentUrl.'?view='.$viewMode; } } + */ } /** diff --git a/ReplyTo/design/replyto.css b/ReplyTo/design/replyto.css index 81027a2..7b8916a 100644 --- a/ReplyTo/design/replyto.css +++ b/ReplyTo/design/replyto.css @@ -3,8 +3,11 @@ display: inline-block; line-height: 1.5; } +.MessageList .ItemDiscussion .Item-Body .Controls a.ReplyViewOptionLink, .ReplyViewOptions .ReplyViewOptionLink { + color: #137d60; +} -.ReplyViewOptions a.Active { +.MessageList .ItemDiscussion .Item-Body .Controls a.ReplyViewOptionLink.Active, .ReplyViewOptions .ReplyViewOptionLink.Active { color: #696969; font-weight: 800; } From 3c96c925a51476e55dbf31b1c55ed600a4771afc Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 26 Mar 2021 10:54:12 +0300 Subject: [PATCH 06/16] Issues-476: fixed challenge roles after updating comments --- Topcoder/class.topcoder.plugin.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index 557519a..7962e57 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -852,16 +852,25 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){ $groupID = $category->GroupID; } } - } else if($args['Controller'] instanceof Groupcontroller) { + } else if($args['Controller'] instanceof GroupController) { if (array_key_exists('groupid', $methodArgs)) { $groupID = (int) $methodArgs['groupid']; } + } else if($args['Controller'] instanceof PostController) { + if (array_key_exists('commentid', $methodArgs)) { + $commentID = $methodArgs['commentid']; + $commentModel = new CommentModel(); + $comment = $commentModel->getID($commentID); + $discussionModel = new DiscussionModel(); + $discussion = $discussionModel->getID($comment->DiscussionID); + if($discussion->CategoryID){ + $categoryModel = new CategoryModel(); + $category = $categoryModel->getID($discussion->CategoryID); + $groupID = $category->GroupID; + } + } } - //} else if($args instanceof CategoriesController) { - //TODO - //} else if ( $args instanceof CategoryController) { - //TODO - //} + if($groupID && $groupID > 0) { $groupModel = new GroupModel(); $group = $groupModel->getByGroupID($groupID); From 50f90614465ecc5c262bdded99c309a414fe051b Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 26 Mar 2021 11:47:28 +0300 Subject: [PATCH 07/16] Issues-476: Fixed challenge roles for user photo links --- Topcoder/class.topcoder.plugin.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index 7962e57..05341e4 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -302,6 +302,7 @@ public function gdn_auth_startAuthenticator_handler() { $headersToken = $this->getBearerToken(); $accessToken = $headersToken ? $headersToken : $cookiesToken; + $accessToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSkZORGd4UlRVME5EWTBOVVkzTlRkR05qTXlRamxETmpOQk5UYzVRVUV3UlRFeU56TTJRUSJ9.eyJodHRwczovL3RvcGNvZGVyLWRldi5jb20vcm9sZXMiOlsiQ29ubmVjdCBTdXBwb3J0IiwidGVzdFJvbGUiLCJhYWEiLCJ0b255X3Rlc3RfMSIsIkNvbm5lY3QgTWFuYWdlciIsIkNvbm5lY3QgQWRtaW4iLCJjb3BpbG90IiwiQ29ubmVjdCBDb3BpbG90IE1hbmFnZXIiLCJUb3Bjb2RlciBVc2VyIiwiYWRtaW5pc3RyYXRvciIsInUtYmFobiJdLCJodHRwczovL3RvcGNvZGVyLWRldi5jb20vdXNlcklkIjoiODU0Nzg5OSIsImh0dHBzOi8vdG9wY29kZXItZGV2LmNvbS9oYW5kbGUiOiJUb255SiIsImh0dHBzOi8vdG9wY29kZXItZGV2LmNvbS91c2VyX2lkIjoiYXV0aDB8ODU0Nzg5OSIsImh0dHBzOi8vdG9wY29kZXItZGV2LmNvbS90Y3NzbyI6Ijg1NDc4OTl8ZmVlYmI2OGE4ZjYwMzdkZDlmYTE5YTY3ODY2ZmY3YTc1NTNhMjZlNTQ1MWI5YWE0Mzg5ZDMyOGQ2ODgwYzkiLCJodHRwczovL3RvcGNvZGVyLWRldi5jb20vYWN0aXZlIjp0cnVlLCJuaWNrbmFtZSI6IlRvbnlKIiwibmFtZSI6ImFqZWZ0c0B0b3Bjb2Rlci5jb20iLCJwaWN0dXJlIjoiaHR0cHM6Ly9zLmdyYXZhdGFyLmNvbS9hdmF0YXIvZjExODkyYzM4MTQwMzZjNjhjNzhmNGNlMGY2Yzg3NjE_cz00ODAmcj1wZyZkPWh0dHBzJTNBJTJGJTJGY2RuLmF1dGgwLmNvbSUyRmF2YXRhcnMlMkZhai5wbmciLCJ1cGRhdGVkX2F0IjoiMjAyMS0wMy0yNFQxODoxMTo0MS4zODhaIiwiZW1haWwiOiJhamVmdHNAdG9wY29kZXIuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImlzcyI6Imh0dHBzOi8vYXV0aC50b3Bjb2Rlci1kZXYuY29tLyIsInN1YiI6ImF1dGgwfDg1NDc4OTkiLCJhdWQiOiJCWFdYVVduaWxWVVBkTjAxdDJTZTI5VHcyWllOR1p2SCIsImlhdCI6MTYxNjYwOTUyMiwiZXhwIjoxNjE2NjA5ODIyLCJub25jZSI6ImJrRnFNRk56Wm05TVZtMUNjRW93TUhGU2RXUkRZbFZzZmtobGVuaHNVRFIyVUZFd1ZrZFZURmROWnc9PSJ9.Cpx63LV-34NVXyUZcjKwYRq_2qM7aJqdJerhpLSdXoWqaAjotOD8tXZWGM9aflokJgAxb0lfkDAwPieTt_rdfBs7HkBfQScTjCPrYsBwXiKAFc1oCYjqIwsuzKv3tYE2FtLpDUh05RGCNMKORMN5meCjfDh7RoHe8q4hEnwSMZc2vgkvMMda-hPxRKedLSQn7jKblSLaWvvpWpsVuR8Ig7qbNh47rRkrODSLlL5Szi0qgxJeycued2a69VzOsigDPbUnqzIZZJitKNVQeZF6WG4eoG7lYV1MBfAnmRgLRezZ8dkJ_AHj_x7PNFlYB_s-mumoWhg9pU0IZ93KW9Lsxg'; if ($cookiesToken) { self::log('Token from Cookies', ['value' => $cookiesToken]); } @@ -2020,7 +2021,7 @@ function userPhoto($user, $options = []) { $userLink = userUrl($fullUser); $topcoderProfile = TopcoderPlugin::getTopcoderUser($user); - if($topcoderProfile !== null) { + if($topcoderProfile) { $attributes['target'] = '_blank'; $userLink = TopcoderPlugin::getTopcoderProfileUrl($name); $topcoderPhotoUrl = val('PhotoUrl', $topcoderProfile); @@ -2029,12 +2030,14 @@ function userPhoto($user, $options = []) { } } + $isTopcoderAdmin = val('IsAdmin', $topcoderProfile); $photoUrl = isset($photoUrl) && !empty(trim($photoUrl)) ? $photoUrl: UserModel::getDefaultAvatarUrl(); $href = (val('NoLink', $options)) ? '' : ' href="'.url($userLink).'"'; Gdn::controller()->EventArguments['User'] = $user; Gdn::controller()->EventArguments['Title'] =& $title; Gdn::controller()->EventArguments['Attributes'] =& $attributes; + Gdn::controller()->EventArguments['IsTopcoderAdmin'] =$isTopcoderAdmin; Gdn::controller()->fireEvent('UserPhoto'); return '' From c1d26280c025aad45337e350c8b2f24842834266 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 26 Mar 2021 11:50:35 +0300 Subject: [PATCH 08/16] Issues-476: Fixed challenge roles for user photo links --- Topcoder/class.topcoder.plugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index 05341e4..68dc2c5 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -302,7 +302,6 @@ public function gdn_auth_startAuthenticator_handler() { $headersToken = $this->getBearerToken(); $accessToken = $headersToken ? $headersToken : $cookiesToken; - $accessToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSkZORGd4UlRVME5EWTBOVVkzTlRkR05qTXlRamxETmpOQk5UYzVRVUV3UlRFeU56TTJRUSJ9.eyJodHRwczovL3RvcGNvZGVyLWRldi5jb20vcm9sZXMiOlsiQ29ubmVjdCBTdXBwb3J0IiwidGVzdFJvbGUiLCJhYWEiLCJ0b255X3Rlc3RfMSIsIkNvbm5lY3QgTWFuYWdlciIsIkNvbm5lY3QgQWRtaW4iLCJjb3BpbG90IiwiQ29ubmVjdCBDb3BpbG90IE1hbmFnZXIiLCJUb3Bjb2RlciBVc2VyIiwiYWRtaW5pc3RyYXRvciIsInUtYmFobiJdLCJodHRwczovL3RvcGNvZGVyLWRldi5jb20vdXNlcklkIjoiODU0Nzg5OSIsImh0dHBzOi8vdG9wY29kZXItZGV2LmNvbS9oYW5kbGUiOiJUb255SiIsImh0dHBzOi8vdG9wY29kZXItZGV2LmNvbS91c2VyX2lkIjoiYXV0aDB8ODU0Nzg5OSIsImh0dHBzOi8vdG9wY29kZXItZGV2LmNvbS90Y3NzbyI6Ijg1NDc4OTl8ZmVlYmI2OGE4ZjYwMzdkZDlmYTE5YTY3ODY2ZmY3YTc1NTNhMjZlNTQ1MWI5YWE0Mzg5ZDMyOGQ2ODgwYzkiLCJodHRwczovL3RvcGNvZGVyLWRldi5jb20vYWN0aXZlIjp0cnVlLCJuaWNrbmFtZSI6IlRvbnlKIiwibmFtZSI6ImFqZWZ0c0B0b3Bjb2Rlci5jb20iLCJwaWN0dXJlIjoiaHR0cHM6Ly9zLmdyYXZhdGFyLmNvbS9hdmF0YXIvZjExODkyYzM4MTQwMzZjNjhjNzhmNGNlMGY2Yzg3NjE_cz00ODAmcj1wZyZkPWh0dHBzJTNBJTJGJTJGY2RuLmF1dGgwLmNvbSUyRmF2YXRhcnMlMkZhai5wbmciLCJ1cGRhdGVkX2F0IjoiMjAyMS0wMy0yNFQxODoxMTo0MS4zODhaIiwiZW1haWwiOiJhamVmdHNAdG9wY29kZXIuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImlzcyI6Imh0dHBzOi8vYXV0aC50b3Bjb2Rlci1kZXYuY29tLyIsInN1YiI6ImF1dGgwfDg1NDc4OTkiLCJhdWQiOiJCWFdYVVduaWxWVVBkTjAxdDJTZTI5VHcyWllOR1p2SCIsImlhdCI6MTYxNjYwOTUyMiwiZXhwIjoxNjE2NjA5ODIyLCJub25jZSI6ImJrRnFNRk56Wm05TVZtMUNjRW93TUhGU2RXUkRZbFZzZmtobGVuaHNVRFIyVUZFd1ZrZFZURmROWnc9PSJ9.Cpx63LV-34NVXyUZcjKwYRq_2qM7aJqdJerhpLSdXoWqaAjotOD8tXZWGM9aflokJgAxb0lfkDAwPieTt_rdfBs7HkBfQScTjCPrYsBwXiKAFc1oCYjqIwsuzKv3tYE2FtLpDUh05RGCNMKORMN5meCjfDh7RoHe8q4hEnwSMZc2vgkvMMda-hPxRKedLSQn7jKblSLaWvvpWpsVuR8Ig7qbNh47rRkrODSLlL5Szi0qgxJeycued2a69VzOsigDPbUnqzIZZJitKNVQeZF6WG4eoG7lYV1MBfAnmRgLRezZ8dkJ_AHj_x7PNFlYB_s-mumoWhg9pU0IZ93KW9Lsxg'; if ($cookiesToken) { self::log('Token from Cookies', ['value' => $cookiesToken]); } From e675f372cd772ff2b223cee9b9b77d318166400f Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 26 Mar 2021 22:40:08 +0300 Subject: [PATCH 09/16] Issues-490: Add reply link in comment/discission options --- ReplyTo/class.replyto.plugin.php | 74 ++++++++++++++++---------------- ReplyTo/design/replyto.css | 4 +- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/ReplyTo/class.replyto.plugin.php b/ReplyTo/class.replyto.plugin.php index 075e229..2047455 100644 --- a/ReplyTo/class.replyto.plugin.php +++ b/ReplyTo/class.replyto.plugin.php @@ -91,39 +91,6 @@ public function base_InlineDiscussionOptionsLeft_handler($sender, $args){ echo ''; } - public function base_inlineCommentOptionsRight_handler($sender, $args) { - ReplyToPlugin::log('base_inlineCommentOptionsRight_handler', []); - - if (!Gdn::Session()->isValid()) { - return; - } - - $discussion = $sender->data('Discussion'); - $isClosed = ((int)$discussion->Closed) == 1; - if ($isClosed) { - return; - } - - //Check permission - $CategoryID = val('PermissionCategoryID', $discussion) ? val('PermissionCategoryID', $discussion) : val('CategoryID', $discussion); - - // Can the user comment on this category, and is the discussion open for comments? - if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) { - return; - } - - $viewMode = self::getViewMode(); - $comment = &$args['Comment']; - $items = & $args['Items']; - $commentID = val('CommentID', $comment); - if(empty($items)) { - $items = []; - } - array_push( $items, anchor( - t('Reply'), - url("/?ParentCommentID=".$commentID."&view=".$viewMode, false), 'ReplyComment')); - } - /** * Set the tree order of all comments in the model as soon as it is instantiated. * It is not clear if there are other plugins that may also wish to change the ordering. @@ -242,9 +209,8 @@ public function base_commentOptions_handler($sender, $args) { return; } - /* $options = &$args['CommentOptions']; - $comment = &$args['Comment']; + $comment = $args['Comment']; $options['ReplyToComment'] = [ 'Label' => t('Reply'), 'Url' => '/?ParentCommentID='.$comment->CommentID, @@ -264,7 +230,43 @@ public function base_commentOptions_handler($sender, $args) { $options[$key]['Url'] = $currentUrl.'?view='.$viewMode; } } - */ + } + + /** + * Add 'Reply' option to discussion. + * + * @param Gdn_Controller $sender + * @param array $args + */ + public function base_inlineDiscussionOptions_handler($sender, $args) { + $discussion = $args['Discussion']; + if (!$discussion) { + return; + } + + $isClosed = ((int)$discussion->Closed) == 1; + if ($isClosed) { + return; + } + + if (!Gdn::session()->UserID) { + return; + } + + //Check permission + if (isset($discussion->PermissionCategoryID)) { + $CategoryID = val('PermissionCategoryID', $discussion); + } else { + $CategoryID = $discussion->CategoryID; + } + + // Can the user comment on this category, and is the discussion open for comments? + if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) { + return; + } + // DropdownModule options + $options = & $args['DiscussionOptions']; + $options->addLink('Reply', url("/", true), 'reply', 'ReplyComment'); } /** diff --git a/ReplyTo/design/replyto.css b/ReplyTo/design/replyto.css index 7b8916a..dea2380 100644 --- a/ReplyTo/design/replyto.css +++ b/ReplyTo/design/replyto.css @@ -1,5 +1,6 @@ .ReplyViewOptions { + font-family: roboto, Segoe UI, Helvetica Neue, Helvetica, Raleway, Arial, sans-serif; display: inline-block; line-height: 1.5; } @@ -8,8 +9,7 @@ } .MessageList .ItemDiscussion .Item-Body .Controls a.ReplyViewOptionLink.Active, .ReplyViewOptions .ReplyViewOptionLink.Active { - color: #696969; - font-weight: 800; + color: #555555; } /* Indent comments according to their depth. From f6ba15fc199fe544f9d777c18398c86d38125e3e Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 26 Mar 2021 23:57:38 +0300 Subject: [PATCH 10/16] Issues-490: Render reply link if user has permissison --- ReplyTo/class.replyto.plugin.php | 39 +++++++++++++------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/ReplyTo/class.replyto.plugin.php b/ReplyTo/class.replyto.plugin.php index 2047455..298cab1 100644 --- a/ReplyTo/class.replyto.plugin.php +++ b/ReplyTo/class.replyto.plugin.php @@ -192,22 +192,20 @@ public function base_commentOptions_handler($sender, $args) { return; } $discussion = $sender->data('Discussion'); - $isClosed = ((int)$discussion->Closed) == 1; - if ($isClosed) { - return; - } //Check permission - if (isset($discussion->PermissionCategoryID)) { - $CategoryID = val('PermissionCategoryID', $discussion); - } else { - $CategoryID = $discussion->CategoryID; - } + $CategoryID = val('PermissionCategoryID', $discussion)? val('PermissionCategoryID', $discussion):val('CategoryID', $discussion); + $userCanClose = CategoryModel::checkPermission($CategoryID, 'Vanilla.Discussions.Close'); + $userCanComment = CategoryModel::checkPermission($CategoryID, 'Vanilla.Comments.Add'); - // Can the user comment on this category, and is the discussion open for comments? - if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) { + $canAddComment = ($discussion->Closed == '1' && $userCanClose) || ($discussion->Closed == '0' && $userCanComment); + if (!$canAddComment) { return; } + // Can the user comment on this category, and is the discussion open for comments? + // if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) { + // return; + // } $options = &$args['CommentOptions']; $comment = $args['Comment']; @@ -244,26 +242,21 @@ public function base_inlineDiscussionOptions_handler($sender, $args) { return; } - $isClosed = ((int)$discussion->Closed) == 1; - if ($isClosed) { - return; - } - if (!Gdn::session()->UserID) { return; } //Check permission - if (isset($discussion->PermissionCategoryID)) { - $CategoryID = val('PermissionCategoryID', $discussion); - } else { - $CategoryID = $discussion->CategoryID; - } + $CategoryID = val('PermissionCategoryID', $discussion)? val('PermissionCategoryID', $discussion):val('CategoryID', $discussion); + $userCanClose = CategoryModel::checkPermission($CategoryID, 'Vanilla.Discussions.Close'); + $userCanComment = CategoryModel::checkPermission($CategoryID, 'Vanilla.Comments.Add'); - // Can the user comment on this category, and is the discussion open for comments? - if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) { + // See the 'writeCommentForm' method vanilla/applications/vanilla/views/discussion/helper_functions.php + $canAddComment = ($discussion->Closed == '1' && $userCanClose) || ($discussion->Closed == '0' && $userCanComment); + if (!$canAddComment) { return; } + // DropdownModule options $options = & $args['DiscussionOptions']; $options->addLink('Reply', url("/", true), 'reply', 'ReplyComment'); From a8dbd79ba57046e2616abe9371b917eb83bd57a0 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sat, 27 Mar 2021 13:40:26 +0300 Subject: [PATCH 11/16] Issues-476: Fixed challenge roles for new comments --- Topcoder/class.topcoder.plugin.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index 68dc2c5..0d11db4 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -827,6 +827,12 @@ public function userController_UserCell_handler($sender, $args) { getID($discussionID); + if($discussion->CategoryID){ + $categoryModel = new CategoryModel(); + $category = $categoryModel->getID($discussion->CategoryID); + $groupID = $category->GroupID; + } + } else if (array_key_exists('commentid', $methodArgs)) { $commentID = $methodArgs['commentid']; $commentModel = new CommentModel(); $comment = $commentModel->getID($commentID); From 5ebf974e3dd0b5ad2b619d933a353bce74b3e969 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sat, 27 Mar 2021 16:35:10 +0300 Subject: [PATCH 12/16] Issues-488: Fixed threaded/flat mode --- ReplyTo/class.replyto.plugin.php | 14 +++++++++++++- ReplyTo/js/replyto.js | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ReplyTo/class.replyto.plugin.php b/ReplyTo/class.replyto.plugin.php index 298cab1..2113438 100644 --- a/ReplyTo/class.replyto.plugin.php +++ b/ReplyTo/class.replyto.plugin.php @@ -66,6 +66,16 @@ public function postController_render_before($sender) { $this->prepareController($sender); } + /** + * Add View Mode before rendering comments + * @param $sender + * @param $args + */ + public function base_beforeCommentsRender_handler($sender, $args) { + $viewMode = self::getViewMode(); + $sender->setData('ViewMode', $viewMode); + } + /** * Render View options for a discussion * @param $sender @@ -264,11 +274,13 @@ public function base_inlineDiscussionOptions_handler($sender, $args) { /** * Insert the indentation classes into the comment. + * All rendering options should be set before displaying comments * @param $sender * @param $args */ public function base_beforeCommentDisplay_handler($sender, $args) { if($sender->deliveryType() != DELIVERY_TYPE_ALL) { + // Ajax request to post new comments or update comments if(isset($_SERVER['HTTP_REFERER'])) { $previous = $_SERVER['HTTP_REFERER']; $query = parse_url($previous, PHP_URL_QUERY); @@ -277,7 +289,7 @@ public function base_beforeCommentDisplay_handler($sender, $args) { if(!$viewMode) { $viewMode = self::isPagingUrl($previous) ? self::VIEW_FLAT : self::VIEW_THREADED; } - + $sender->setData('ViewMode', $viewMode); if($viewMode == self::VIEW_THREADED) { $this->buildCommentReplyToCssClasses($sender); } diff --git a/ReplyTo/js/replyto.js b/ReplyTo/js/replyto.js index 43a48da..f3eb389 100644 --- a/ReplyTo/js/replyto.js +++ b/ReplyTo/js/replyto.js @@ -15,12 +15,22 @@ jQuery(document).ready(function($) { var parent = $(btn).parents('.MainContent'); var commentContainer = $(parent).find('div.CommentForm'); var header = $(commentContainer).find('h2.H'); - $(header).text('Reply to a comment'); // Form var form = $(commentContainer).find('form#Form_Comment'); var href = $(btn).attr('href'); var commentID = param(href,'ParentCommentID'); var hiddenField = $(form).find(':input[type="hidden"]#Form_ParentCommentID') + + var author = ''; + if(commentID == '') { // No Parent Comment, Reply to Discussion + commentID = 0; + author = $(btn).parents('.Discussion').find('.Item-Header.DiscussionHeader .Author .topcoderHandle').text(); + } else { + author = $(btn).parents('.Comment').find('.Item-Header.CommentHeader .Author .topcoderHandle').text(); + } + + $(header).text('Replying to '+ author); + if($(hiddenField).length == 0) { var el = ''; $(form).append(el); @@ -30,11 +40,11 @@ jQuery(document).ready(function($) { var formButtons = $(form).find('.Buttons'); var postCommentButton = $(form).find('.CommentButton'); postCommentButton.val('Post Reply'); - var backButton = $(formButtons).find('span.Back'); + var backButton = $(formButtons).find('.Button.PreviewButton'); var cancelReplyButton = $(formButtons).find('span.Reply'); if($(cancelReplyButton).length == 0) { var cancelReplyButton = 'Cancel Reply'; - $(cancelReplyButton).insertAfter(backButton); + $(cancelReplyButton).insertBefore(backButton); } else { $(cancelReplyButton).show(); } From f3aac2118e177b5c2b39c572e39065387e9b8297 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sun, 28 Mar 2021 15:25:03 +0300 Subject: [PATCH 13/16] Issues-498: fixed threaded/flat mode for anonymous --- ReplyTo/class.replyto.plugin.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/ReplyTo/class.replyto.plugin.php b/ReplyTo/class.replyto.plugin.php index 2113438..d4d605d 100644 --- a/ReplyTo/class.replyto.plugin.php +++ b/ReplyTo/class.replyto.plugin.php @@ -144,9 +144,6 @@ public function commentModel_deleteComment_handler(&$Sender) { } public function discussionController_BeforeCalculatingOffsetLimit_handler($sender, $args) { - if (!Gdn::session()->isValid()) { - return; - } $viewMode = self::getViewMode(); // $offsetProvided = $args['OffsetProvided']; $discussion = $args['Discussion']; From f98cce3217ed1cc39f303c637d2420b45a32475a Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sun, 28 Mar 2021 16:10:08 +0300 Subject: [PATCH 14/16] Issues-488: formating nested comments --- ReplyTo/design/replyto.css | 99 ++++++++++++++++++++++++++- ReplyTo/models/class.replytomodel.php | 2 +- 2 files changed, 98 insertions(+), 3 deletions(-) diff --git a/ReplyTo/design/replyto.css b/ReplyTo/design/replyto.css index dea2380..bda51b1 100644 --- a/ReplyTo/design/replyto.css +++ b/ReplyTo/design/replyto.css @@ -56,8 +56,103 @@ li.Item.ReplyToDepth-9 { margin-left: 14em; } -/* Stop indenting any further after 10 levels */ -li.Item.ReplyToDepth-10plus { +li.Item.ReplyToDepth-10 { margin-left: 15em; } +li.Item.ReplyToDepth-11 { + margin-left: 16em; +} + +li.Item.ReplyToDepth-12 { + margin-left: 17em; +} + +li.Item.ReplyToDepth-13 { + margin-left: 18em; +} + +li.Item.ReplyToDepth-14 { + margin-left: 19em; +} + +li.Item.ReplyToDepth-15 { + margin-left: 20em; +} + + +/* Stop indenting any further after 15 levels */ +li.Item.ReplyToDepth-16plus { + margin-left: 20em; +} + +@media screen and (max-width: 960px) { + li.Item.ReplyToDepth-1 { + margin-left: 1em; + } + + li.Item.ReplyToDepth-2 { + margin-left: 1.25em; + } + + li.Item.ReplyToDepth-3 { + margin-left: 1.5em; + } + + li.Item.ReplyToDepth-4 { + margin-left: 1.75em; + } + + li.Item.ReplyToDepth-5 { + margin-left: 2em; + } + + /* Reduce the indenting to single ems after 5 levels */ + + li.Item.ReplyToDepth-6 { + margin-left: 2.25em; + } + + li.Item.ReplyToDepth-7 { + margin-left: 2.5em; + } + + li.Item.ReplyToDepth-8 { + margin-left: 2.75em; + } + + li.Item.ReplyToDepth-9 { + margin-left: 3em; + } + + li.Item.ReplyToDepth-10 { + margin-left: 3.25em; + } + + li.Item.ReplyToDepth-11 { + margin-left: 3.5em; + } + + li.Item.ReplyToDepth-12 { + margin-left: 3.75em; + } + + li.Item.ReplyToDepth-13 { + margin-left: 4em; + } + + li.Item.ReplyToDepth-14 { + margin-left: 4.25em; + } + + li.Item.ReplyToDepth-15 { + margin-left: 4.5em; + } + + + /* Stop indenting any further after 15 levels */ + li.Item.ReplyToDepth-16plus { + margin-left: 5em; + } + +} \ No newline at end of file diff --git a/ReplyTo/models/class.replytomodel.php b/ReplyTo/models/class.replytomodel.php index d1712ec..2196267 100644 --- a/ReplyTo/models/class.replytomodel.php +++ b/ReplyTo/models/class.replytomodel.php @@ -293,7 +293,7 @@ public function depthClasses($depth) { // Add some further classes for blocks of each 5 depth levels, so limits can // be set on the way depth is formatted. - for ($i = 1; $i <= 100; $i += 5) { + for ($i = 1; $i <= 20; $i += 5) { if ($depth >= $i) { $Class .= ' ' . $Prefix . '-' . $i . 'plus'; } else { From 92c8df2a0570659df9c59406372911f420ffe128 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sun, 28 Mar 2021 21:09:15 +0300 Subject: [PATCH 15/16] Issues-491: set the scroll animation settings as in quotes plugin --- ReplyTo/js/replyto.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ReplyTo/js/replyto.js b/ReplyTo/js/replyto.js index f3eb389..5ed35b1 100644 --- a/ReplyTo/js/replyto.js +++ b/ReplyTo/js/replyto.js @@ -7,7 +7,7 @@ jQuery(document).ready(function($) { //If view is not flat, reload a page to rebuild a tree function reloadPage() { var currentView = param(window.location.href, 'view'); - return (currentView == 'tree' || currentView == 'threaded'); + return currentView == 'threaded'; } $(document).on('click','a.ReplyComment', function(ev) { @@ -48,7 +48,9 @@ jQuery(document).ready(function($) { } else { $(cancelReplyButton).show(); } - $(form)[0].scrollIntoView(); + + var ScrollY = $(form).offset().top - 100; + $('html,body').animate({scrollTop: ScrollY}, 800); return false; }); From afa05839faf8c1601c202fe40d016b79e2453841 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Mon, 29 Mar 2021 12:39:48 +0300 Subject: [PATCH 16/16] Issues-508:Updated Profile Settings link --- Topcoder/views/modules/topcoderme.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Topcoder/views/modules/topcoderme.php b/Topcoder/views/modules/topcoderme.php index 1123f4c..c869990 100644 --- a/Topcoder/views/modules/topcoderme.php +++ b/Topcoder/views/modules/topcoderme.php @@ -108,7 +108,8 @@ // $dropdown->addLinkIf(hasViewProfile(Gdn::session()->UserID), t('View Profile'), '/profile', 'profile.view', '', [], $editModifiers); $preferencesModifiers['listItemCssClasses'] = ['MeButtonMenuItem', 'MeButtonSettingsItem']; - $dropdown->addLinkIf(hasEditProfile(Gdn::session()->UserID), 'Settings', '/profile/preferences', 'profile.preferences', '', [], $preferencesModifiers); + // $dropdown->addLinkIf(hasEditProfile(Gdn::session()->UserID), 'Settings', '/profile/preferences', 'profile.preferences', '', [], $preferencesModifiers); + $dropdown->addLink('Settings', 'https://www.topcoder.com/settings/profile', 'profile.preferences', '', [], $preferencesModifiers); // $applicantModifiers = $ApplicantCount > 0 ? ['badge' => $ApplicantCount] : []; // $applicantModifiers['listItemCssClasses'] = ['link-applicants'];