changes.mady.by.user Alex Lee
Saved on Aug 19, 2020
...
<div id="edit-style-container"> </div> <script> const countryAdminGroup = getQueryVariableFromUrl("cc") + "-admins"; var adminCanEdit = false; async function checkIfCountryAdmin () { let groupsRes = await jQuery.ajax({ url: "/rest/api/user/memberof?username=" + AJS.params.remoteUser, type: "get", dataType: "json" }).then(res => res); groupsRes = groupsRes.results; console.log(groupsRes); for (let i = 0; i < groupsRes.length; i++) { let groupName = groupsRes[i].name; if (groupName === countryAdminGroup) { adminCanEdit = true; } } return true; } checkIfCountryAdmin().then(res => { if (!adminCanEdit) { document.getElementById("edit-style-container").innerHTML = (`<style> .micropost .micropost-right .micropost-header .micropost-action-menu.show-permanent { display: none !important; } </style>`); } }); </script>