Implement webpush for push notifications #4031

Merged
hansegucker merged 25 commits from feature/webpush into master 2026-10-23 19:16:31 +02:00
Member

Information and screenshots

Closes #1102

Closes #168

Checklist

  • tox -e reformat,lint used
  • Changelog updated/No update necessary
  • Documentation (incl. Screenshots) up-to-date
  • Copyright in apps.py and README.rst up-to-date
  • (Unit) tests for new feature/regression tests for bug fixes (only if useful)
  • Adhere to URL scheme
  • Tested with admin account
  • Tested with normal account (based on permissions)

Backend checklist

  • Use permissions for all GraphQL mutations
  • Use query optimizer for all GraphQL queries
  • Don't use inefficient DB queries

Frontend checklist (mandatory with ~"part::frontend")

## Information and screenshots Closes #1102 Closes #168 ## Checklist - [x] `tox -e reformat,lint` used - [x] Changelog updated/No update necessary - [x] Documentation (incl. Screenshots) up-to-date - [ ] Copyright in `apps.py` and `README.rst` up-to-date - [ ] (Unit) tests for new feature/regression tests for bug fixes (only if useful) - [ ] Adhere to [URL scheme](https://code.teckids.org/aleksis/aleksis/issues/86) - [x] Tested with admin account - [x] Tested with normal account (based on permissions) ## Backend checklist - [x] Use permissions for all GraphQL mutations - [ ] Use query optimizer for all GraphQL queries - [ ] Don't use inefficient DB queries ## Frontend checklist (mandatory with ~"part::frontend") - [x] Screenshots are attached (mobile and desktop) - [ ] Tested on mobile, tablet, and desktop sizes - [ ] Adhered to [frontend guidelines](hhttps://code.teckids.org/aleksis/AlekSIS/src/branch/master/project/frontend_guidelines.rst) - [ ] Checked with [Firefox Accessibility Checker](https://firefox-source-docs.mozilla.org/devtools-user/accessibility_inspector/)
Send push notifications
Some checks failed
CI / lock (push) Successful in 40s
CI / build (push) Failing after 36s
CI / test (push) Failing after 40s
CI / lint (push) Failing after 42s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
a79e344462
Append notificaiton id
Some checks failed
CI / lock (push) Successful in 38s
CI / build (push) Failing after 35s
CI / test (push) Failing after 38s
CI / lint (push) Failing after 41s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
5baab6ea2d
Fix error handling
Some checks failed
CI / lock (push) Successful in 39s
CI / build (push) Failing after 39s
CI / test (push) Failing after 41s
CI / lint (push) Failing after 44s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
8644c72cdb
Merge branch 'refs/heads/master' into feature/webpush
Some checks failed
CI / lock (push) Successful in 32s
CI / build (push) Failing after 38s
CI / test (push) Failing after 41s
CI / lint (push) Failing after 44s
CI / tests-done (push) Failing after 3s
CI / publish (push) Has been skipped
6e86d15725
Document webpush
Some checks failed
CI / lock (push) Successful in 35s
CI / build (push) Failing after 38s
CI / test (push) Failing after 41s
CI / lint (push) Failing after 43s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
ef8d4d848e
Reformat
Some checks failed
CI / lock (push) Successful in 40s
CI / build (push) Failing after 36s
CI / test (push) Failing after 40s
CI / lint (push) Failing after 47s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
83bc4d41e0
Fix fallback for disabled push notifications
Some checks failed
CI / lock (push) Successful in 32s
CI / build (push) Failing after 37s
CI / test (push) Failing after 41s
CI / lint (push) Failing after 49s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
6840041250
Hide push notification menu entry if they are disabled
Some checks failed
CI / lock (push) Successful in 36s
CI / build (push) Failing after 38s
CI / test (push) Failing after 41s
CI / lint (push) Failing after 49s
CI / tests-done (push) Failing after 2s
CI / publish (push) Has been skipped
6d1d424fd4
@ -0,0 +23,4 @@
function getBrowser() {
const ua = navigator.userAgent;
if (ua.includes("Edg/")) return "Edge";
Owner

I would suggest using an object to store this mapping and then a find.

I would suggest using an object to store this mapping and then a find.
leuckeju marked this conversation as resolved
@ -738,2 +739,4 @@
name: "core.oauth.deleteAuthorizedToken",
},
{
path: "/o/push_notifications/web_push_device/",
Owner

/o/core/webpushdevice

`/o/core/webpushdevice`
leuckeju marked this conversation as resolved
@ -740,0 +741,4 @@
{
path: "/o/push_notifications/web_push_device/",
component: () => import("./components/webpush/WebPushDevices.vue"),
name: "core.WebpushDevices",
Owner

core.webpushDevices

`core.webpushDevices`
leuckeju marked this conversation as resolved
@ -0,0 +19,4 @@
const getNotificationOptions = function (message, message_tag) {
return {
body: message,
// TODO: Figure out how to access the icon from the Django static files
Owner

TODO? Drop or solve

TODO? Drop or solve
leuckeju marked this conversation as resolved
@ -0,0 +31,4 @@
});
self.addEventListener("push", async function (event) {
console.log("PUSH RECEIVED", event);
Owner

Better logging or no logging, please

Better logging or no logging, please
leuckeju marked this conversation as resolved
@ -66,0 +83,4 @@
# - Boolean `active`, which indicates whether the channel is enabled by an administrator
# - Boolean `selectable`, which indicates this channel is an option in the user preferences
# - Function to send notification through the channel
Channel = namedtuple("Channel", ["name", "active", "selectable", "send"])
Owner

If you already rewrite this, please use a RegistryObject with the notification method being part of the classes.

If you already rewrite this, please use a `RegistryObject` with the notification method being part of the classes.
leuckeju marked this conversation as resolved
Move browser<->ua to mapping
Some checks failed
CI / lock (push) Successful in 42s
CI / build (push) Failing after 37s
CI / test (push) Failing after 39s
CI / lint (push) Failing after 45s
CI / tests-done (push) Failing after 3s
CI / publish (push) Has been skipped
d36fb4e137
Refactor Channels as RegistryObjects
Some checks failed
CI / lock (push) Successful in 42s
CI / build (push) Failing after 38s
CI / test (push) Failing after 39s
CI / lint (push) Failing after 44s
CI / tests-done (push) Failing after 3s
CI / publish (push) Has been skipped
03227112bf
Move notification logic to classes
Some checks failed
CI / lock (push) Successful in 32s
CI / test (push) Failing after 35s
CI / lint (push) Failing after 41s
CI / build (push) Failing after 43s
CI / tests-done (push) Failing after 4s
CI / publish (push) Has been skipped
4752af509e
hansegucker force-pushed feature/webpush from 4752af509e
Some checks failed
CI / lock (push) Successful in 32s
CI / test (push) Failing after 35s
CI / lint (push) Failing after 41s
CI / build (push) Failing after 43s
CI / tests-done (push) Failing after 4s
CI / publish (push) Has been skipped
to 5039e493dc
All checks were successful
CI / lock (push) Successful in 28s
CI / lint (push) Successful in 1m7s
CI / build (push) Successful in 1m47s
CI / test (push) Successful in 4m11s
CI / tests-done (push) Successful in 3s
CI / publish (push) Successful in 12s
2026-10-23 15:34:44 +02:00
Compare
Fix changelog
All checks were successful
CI / lock (push) Successful in 46s
CI / lint (push) Successful in 1m16s
CI / build (push) Successful in 1m20s
CI / test (push) Successful in 3m37s
CI / tests-done (push) Successful in 2s
CI / publish (push) Successful in 12s
18302d19eb
hansegucker deleted branch feature/webpush 2026-10-23 19:16:32 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
aleksis/AlekSIS-Core!4031
No description provided.