Skip to content

Conversation

fettuccinae
Copy link
Contributor

@fettuccinae fettuccinae commented Aug 15, 2025

Added /digest-setting endpoints and their respective methods to interact with MeB.org digest preference endpoints.
Removed unused imports.

@fettuccinae fettuccinae changed the title Add digest preference related endpoints. Add endpoints for digest settings. Aug 18, 2025
@fettuccinae
Copy link
Contributor Author

@mayhem -- PR ready for review.

@mayhem
Copy link
Member

mayhem commented Aug 18, 2025

@MonkeyDo can you please have a look at the react bits?

Copy link
Member

@mayhem mayhem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, lets get @MonkeyDo's feedback.

response.raise_for_status()


def get_digest_preference(musicbrainz_row_id: int) -> dict:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstrings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry. Got lost in branches. Added it now.

Copy link
Member

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think we need to think about other (future) options and settings for notifications rather than just adding this one input.

I envision a separate settings sub-page (see screenshot below, left column), which for now can contain only these three things: a switch for email notifications, a switch for digest emails and the input for the number of days.

I threw this mockup together, using the "Music Player" settings page (source) markup as the base:

  • The first switch should say "Enable e-mail notifications" with an 's' at the end
  • The save button is missing in this screenshot but should be like the second screenshot
Image

The digest section automatically collapses when emails are disabled (using the <summary> and <details> html elements).
Functionally, disabling emails should also disable digest once you click save (I understand that we might not have an endpoint yet to disable emails entirely but we'll be set up for the future).
We should also show an alert (css classes: alert alert-info) when emails are disabled:

Image

<label htmlFor="digest-age" className="form-label">
Digest age (in days)
</label>
<input
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you like the number of days input inline, like I did in my mockup?
I used this markup if it is useful:

<div class="mb-4">Send digest emails every <input type="number" class="d-inline form-control" id="digest-age" min="1" max="100" style="max-width: 4em;"> days</div>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer your version, its more informative.

className="form-control"
id="digest-age"
min={1}
max={100}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if that is an acceptable upper limit.
100 days seems like a lot for a digest...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently have 100 set as the upper limit in the endpoint. But yes, its a lot. What do you think would be a reasonable upper limit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

30 days.

id="digest-age"
min={1}
max={100}
value={digestAge ?? ""}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should be the default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can pass it as None through the endpoint, MeB server will default it to 7 days.

@fettuccinae
Copy link
Contributor Author

fettuccinae commented Aug 18, 2025

@MonkeyDo I like your mockup better. I'll implement a separate notification sub-settings page. Should I make another PR for it since this one will get big, and remove the react bits from this one?

@MonkeyDo
Copy link
Member

@MonkeyDo I like your mockup better. I'll implement a separate notification sub-settings page. Should I make another PR for it since this one will get big, and remove the react bits from this one?

I think it is fine to merge the PR as is and do those changes in another PR.

Copy link
Member

@mayhem mayhem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK by me, but can we please add a little bit of more text explaining what the user options are?

"ListenBrainz may need to contact you about important events about your ListenBrainz account (e.g. problems with connected services) or about events that are happening on ListenBrainz. We will always send the important emails immediately, but all other notifications can be turned off, or sent via a digest periodically:"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants