Many of the currently open pull requests are for adding new lemmy-ui user settings, for example keyboard navigation or infinite scroll. These settings are surely useful, but the process for adding them is unnecessarily complicated. Not only does a new setting have to be implemented in lemmy-ui, it also requires changes to this repo for adding a database migration, as well as adding the setting to various database and api structs.

This results in very repetetive work to implement and review such changes. It would be good if the process could be simplified in one way or another. A related problem is that we only store settings for lemmy-ui, but it would also be useful to store settings for alternative frontends and client apps.

One possible solution would be not to store individual settings, but an arbitrary json blob where Lemmy doesnt need to care about the content at all. This would also allow a user to store multiple settings blobs for different frontends/clients. Lemmy would have to do nothing more than provide endpoints for writing/reading the settings, and enforce a size limit.

Are there other solutions worth considering?

Originally posted by Nutomic in #3584

  • issue_tracking_bot@lemm.eeOPB
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    I agree, it makes a lot of sense to have a Rust struct for validation of user settings, which gets stored in the database in a single json column. The new settings struct would essentially consist of most LocalUser members, excluding id, person_id, password_encrypted and email. To keep the current behaviour of well-typed settings, it musnt have any other property with serde flatten. Adding new settings would then only require a new field in the settings struct, no need for any db migrations or other code changes. Removing or editing settings would probably require code migrations to rewrite existing db entries, but thats not common anyway.

    This approach doesnt require any api changes, only some internal refactoring. I agree that we dont need to handle settings for other apps, it would get too complicated.

    Originally posted by Nutomic in #3584