Better storage #1615

Closed
hj wants to merge 0 commits from gitlab-mr-iid-343 into develop
Member

See #144

What this does:

  1. Separates instance-related options (static/config.json, api-provided config, nodeinfo) into a separate module called instance. This cleans up a bit of confusion between user settings and instance settings, in this case it handles option collapseMessageWithSubject more gracefully, without temporarily renaming property name. This leaves more freedom for more options that admins may set for instance by default but user may change it nonetheless. Also leaves ground to separate instance options and backend features, however it's kinda messy right now so i did not dig into it.
  2. Removes 60s throttle. Currently nearly every action triggers persistent storage to store data into localstorage, the previous solution was to use throttle, but that causes the awkward "do not refresh page after changes or they will become lost". Removing it doesn't seem to harm the performance, but just in case I've added a whitelist of what actions do trigger persistent storage saving. Maybe i'll rework it into a one action that does trigger saving and use that in all that need saving.
  3. The newly introduced instance module also tries to keep all fields that are eventually get written into it to maintain some defaults, so it would also work without config.json which, in the future we'll change into config.sample.json
  4. Another module was introduced - interface - this is mainly for stuff not directly related to anything and mostly for UI's internal housekeeping. Currently setPageTitle is moved there and also stuff for giving feedback on whether settings were saved or not. I also wanted to move i18n stuff there but honestly couldn't figure out how to actually do that.
  5. Allows FE to work without static/config.json and api/statusnet/config.json, completely relying on built-in defaults. even without user settings
  6. Fixes some small things like mystical error when user isn't logged in and trying to fetch a friends timeline.

I'm currently testing it on SGSGB to see how it works.

See #144 What this does: 1. Separates instance-related options (static/config.json, api-provided config, nodeinfo) into a separate module called `instance`. This cleans up a bit of confusion between user settings and instance settings, in this case it handles option `collapseMessageWithSubject` more gracefully, without temporarily renaming property name. This leaves more freedom for more options that admins may set for instance by default but user may change it nonetheless. Also leaves ground to separate instance _options_ and backend _features_, however it's kinda messy right now so i did not dig into it. 2. Removes 60s throttle. Currently nearly every action triggers persistent storage to store data into localstorage, the previous solution was to use throttle, but that causes the awkward "do not refresh page after changes or they will become lost". Removing it doesn't seem to harm the performance, but just in case I've added a whitelist of what actions do trigger persistent storage saving. Maybe i'll rework it into a one action that does trigger saving and use that in all that need saving. 3. The newly introduced `instance` module also tries to keep all fields that are eventually get written into it to maintain some defaults, so it would also work without `config.json` which, in the future we'll change into `config.sample.json` 4. Another module was introduced - `interface` - this is mainly for stuff not directly related to anything and mostly for UI's internal housekeeping. Currently `setPageTitle` is moved there and also stuff for giving feedback on whether settings were saved or not. I also wanted to move i18n stuff there but honestly couldn't figure out how to actually do that. 5. Allows FE to work without `static/config.json` and `api/statusnet/config.json`, completely relying on built-in defaults. even without user settings 6. Fixes some small things like mystical error when user isn't logged in and trying to fetch a friends timeline. I'm currently testing it on SGSGB to see how it works.
Author
Member

3 days in and it works pretty well. I want to improve code tho.

3 days in and it works pretty well. I want to improve code tho.
First-time contributor

Why did you move the russian i18n file in this MR?
Shouldn’t it be already done in #1609 ?

Why did you move the russian i18n file in this MR? Shouldn’t it be already done in https://git.pleroma.social/pleroma/pleroma-fe/pulls/1609 ?
Author
Member

Probably just started branch on a wrong commit, i'll rebase when i get to it.

Probably just started branch on a wrong commit, i'll rebase when i get to it.
Author
Member

yeah, 9f84f4ea05 should not be in this MR.

yeah, 9f84f4ea052bd64e4989c1842736f956c149d18c should not be in this MR.
Author
Member

ok i wanted to change the way storage is saved - instead of having a whitelist of mutations that trigger saving actually triggering it programmatically by emitting some event but that would've involved either an empty mutation or rewriting persistent storage entirely and i don't want to do that yet.

Yes in the end there are two whitelists now instead of one, but one of the whitelists is much shorter now and other one doesn't really need to be touched that often so i think in the end it does resolve issues with "oh shit this setting doesn't save" and "oh shit this setting gets overwritten by instance's config"

On top of that, getting rid of throttling allows debugging these issues much better.

ok i wanted to change the way storage is saved - instead of having a whitelist of mutations that trigger saving actually triggering it programmatically by emitting some event but that would've involved either an empty mutation or rewriting persistent storage entirely and i don't want to do that yet. Yes in the end there are two whitelists now instead of one, but one of the whitelists is much shorter now and other one doesn't really need to be touched that often so i think in the end it does resolve issues with "oh shit this setting doesn't save" and "oh shit this setting gets overwritten by instance's config" On top of that, getting rid of throttling allows debugging these issues much better.
Author
Member

Seems to be working fine with latest changes...

Seems to be working fine with latest changes...
Author
Member

Added a display for instance default. Probably should make that somewhat universal in the future.
image

Added a display for instance default. Probably should make that somewhat universal in the future. ![image](/attachments/313b5741-62a4-412f-9ac0-6de61e86289c)
Author
Member

image
lgtm by shp on irc

![image](/attachments/f65f8fe7-159c-4b00-b6fe-90fdb7b4d26e) lgtm by shp on irc
4.2 KiB

Pull request closed

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
pleroma/pleroma-fe!1615
No description provided.