Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding additional vote display modes #1378
Adding additional vote display modes #1378
Changes from 6 commits
db14038
b3b9e9a
fe4c0ee
2fceefb
2c48cec
5c4e896
0d690c3
e39a355
387a674
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what makes this all temporary. When this actually comes back from the siteRes, then we can remove it.
I thought at first that we need to persist this setting, but I guess not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't persist this? Don't we keep resetting it each time the user opens the app again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is : Which local user settings should we be saving to our local database?
I think we only really need to save things required before the first fetch, so
default_sort_type
. But as for other things that come back withgetSite
? I'm not sure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should discuss this, but not only the context of this setting but like sort options on each screen too.
For backwards compatibility it seems that we will need to save the above setting too unless it not persistenting for older versions is intended.
Also I don't think it is guaranteed that getSite has returned before feed loads? So initially it won't be correct occasionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it won't be correct until after GetSite has loaded. In practice I haven't seen a case where the any feed loads faster than GetSite tho.
In that
SiteViewModel
, the current things that could be persisted are admins, followList, voteDisplayMode, enableDownvotes, and showAvatars.If we decide to persist them, we should do that as a later PR, all at once tho. I'm not 100% convinced its worth it... but we do already have everything set up (persisting them would work exactly like
default_sort_type
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That must be very situational. I just tested 5 times on my phone and all 5 times it did the feed request and response before the site response. You can check this by checking in the log, the order for the responses
(request)
(response)
I care less about those are more about things we don't persist at all, like the sort types on each screen (communityview, postview, ...)
Maybe we should devise a much more flexible system that doesn't require so much overhead (as code) for persisting more fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort types on each screen should just use the
default_sort_type
, which is already saved in the DB.We could add a string / JSON field for user settings, but I really don't like putting untyped things in the DB, as that makes migrations and many other things a nightmare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't reuse default sort because it is in a different context+ different enum (sometimes)
For example comment sort options
or sort options in saved/own profile would be different context where you wouldn't want to reuse the same sort as for the feed
I'm also not a fan of Json but I was more - thinking of additional table that has 1 to many relationship and holds acc id, fieldname, field state. Or something so that we wouldn't need migrations to add more fields to persist. I don't want to bloat Account to much. End goal would be that we just add single column to a data class and the infra would take care of everything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add default_comment_sort for users and sites eventually: LemmyNet/lemmy#4128
I'm not sure what would be best, but at least for now lets just add more columns to the account table as necessary.