From 735e75fa2178a3a44677067236432b74216c85e9 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Sun, 5 Dec 2021 00:08:40 +0300 Subject: [PATCH] AJAX: Fix when group does not adding to left menu if the group itself have a custom url --- Web/Presenters/templates/User/Groups.xml | 2 +- Web/static/js/openvk.cls.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml index 9c2aa853..e740694d 100644 --- a/Web/Presenters/templates/User/Groups.xml +++ b/Web/Presenters/templates/User/Groups.xml @@ -56,7 +56,7 @@ {_actions}: - + {if $clubPinned} {_remove_from_left_menu} {else} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 1e1cf6a0..4195e5e7 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -91,7 +91,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN let link = u(this).attr("href"); let thisButton = u(this); let groupName = u(this).attr("data-group-name"); - let groupId = u(this).attr("data-group-id"); + let groupUrl = u(this).attr("data-group-url"); let list = u('#_groupListPinnedGroups'); let req = await ky(link); @@ -109,13 +109,13 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN thisButton.html(tr('add_to_left_menu')); for(let i = 0; i < list.nodes[0].children.length; i++) { let element = list.nodes[0].children[i]; - if(element.pathname == '/club'+groupId) { + if(element.pathname == groupUrl) { element.remove(); } } }else{ thisButton.html(tr('remove_from_left_menu')); - list.nodes[0].append(u('' + groupName + '').first()); + list.nodes[0].append(u('' + groupName + '').first()); } // Adding the group to the left group list