agdsn / sipa

The Supreme Information Providing Application
MIT License
13 stars 10 forks source link

Add option to subscribe to status page #458

Closed mabezi closed 1 year ago

mabezi commented 1 year ago

Subscribing to the status page should be done in SIPA usersuite in the future. The status page has an API endpoint for this.

Here's how I would think of implementing it:

It is questionable whether the last point can be implemented directly or whether an additional field should be saved for the user to check whether the user has already subscribed to the status page.

lukasjuhrich commented 1 year ago

I'm not sure I understand the last point. Who is „you“? Sipa? Do you have any links documenting the API?

What's the precise process of figuring out whether a user is subscribed? Users just subscribe via email, don't they? Do we just assume agdsn.me-addresses belong to pycroft?

lukasjuhrich commented 1 year ago

As a starting point, you can copy the implementation of the userdb property to try to implement statuspage_subscribed or however you want to name it.

mabezi commented 1 year ago

I'm not sure I understand the last point. Who is „you“? Sipa?

This is what happens when you throw a sentence into a translator and don't check if it is correctly translated. This time I'll do it without translation tools.

The management key is needed if you want to give the user the possibility to make settings by himself. The URL for the settings looks something like this: https://status.agdsn.net/subscribers/MANAGEMENT_KEY/manage

At the moment you could retrieve this management key using this page: https://status.agdsn.net/subscribers/reqeust-management-key However, this URL is not linked anywhere at the moment, as it would normally be displayed on the subscribe page. (Which is disabled at the moment because there is no CAPTCHA enabled.)

Another way of retrieving this key is by waiting for an message from the status page since there is always a URL (incl. management key) to unsubscribe in these emails.

Do you have any links documenting the API?

Normally there would be documentation, but it is not available right now because of an bug. The URL to the documentation would be: https://status.agdsn.net/api/docs/ (or if you don't like swagger there would be https://status.agdsn.net/api/redoc/)

I could give you the link to a private test instance with an older version where the documentation still works. But I assume that the bug will be fixed soon anyway.

What's the precise process of figuring out whether a user is subscribed? Users just subscribe via email, don't they? Do we just assume agdsn.me-addresses belong to pycroft?

That's the point where it would be open to me how we implement that. The only thing I can think of spontaneously is an API call whether the mail address stored in Pycroft (not necessarily the agdsn.me-address) is already subscribed.

Do you have any better idea?

mabezi commented 1 year ago

resolved with #461