Web Push Notifications: Disable script when impersonated
If an admin needs to impersonate a regular user (to diagnose a support issue or investigate a reported conversation thread), the web push script is disabled so that the admin doesn't get subscribed to push notifications for that user.
This commit is contained in:
parent
7991320256
commit
ae84ddf449
|
@ -1563,7 +1563,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
$pushDeniedHelp = document.querySelector("#push-denied-help");
|
||||
|
||||
// Is the Notification API unavailable?
|
||||
if (typeof(window.Notification) === "undefined") {
|
||||
if (typeof(window.Notification) === "undefined" || typeof(PushNotificationSubscribe) === "undefined") {
|
||||
$pushStatusDefault.innerHTML = `<i class="fa fa-xmark mr-1"></i> Notification API unavailable`;
|
||||
$pushStatusDefault.style.display = "";
|
||||
return;
|
||||
|
|
|
@ -381,7 +381,10 @@
|
|||
<script type="text/javascript" src="/static/js/vue-3.2.45.js"></script>
|
||||
<script type="text/javascript" src="/static/js/htmx-1.9.12.min.js"></script>
|
||||
<script type="text/javascript" src="/static/js/slim-forms.js?build={{.BuildHash}}"></script>
|
||||
<script type="text/javascript" src="/static/js/web-push.js?build={{.BuildHash}}"></script>
|
||||
{{if not .SessionImpersonated -}}
|
||||
{{- /* Disable web push script if impersonated, so an admin doesn't subscribe to user's notifications */ -}}
|
||||
<script type="text/javascript" src="/static/js/web-push.js?build={{.BuildHash}}"></script>
|
||||
{{- end}}
|
||||
{{template "scripts" .}}
|
||||
|
||||
<!-- Likes modal -->
|
||||
|
|
Loading…
Reference in New Issue
Block a user