-
Notifications
You must be signed in to change notification settings - Fork 43
fix: allowing reading items from preview feeds #166
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
fix: allowing reading items from preview feeds #166
Conversation
- Added another constructor for an in memory sqlite db for previews - Some small error handling cleanup - A bit of other conditionals to handle preview feeds
internal/store/store.go
Outdated
| } | ||
|
|
||
| func (sls *SQLiteStore) UpsertItem(item Item) error { | ||
| func (sls *SQLiteStore) UpsertItem(item Item) (int, error) { |
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 think the changes are much less invasive if instead of adding an additional return parameter you instead have this take a pointer-to-Item:
| func (sls *SQLiteStore) UpsertItem(item Item) (int, error) { | |
| func (sls *SQLiteStore) UpsertItem(item *Item) error { |
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.
Yeah that's a great idea.
cmd/nom/main.go
Outdated
| s, err := store.NewSQLiteStore(cfg.ConfigDir, cfg.Database) | ||
| var s store.Store | ||
| if cfg.IsPreviewMode() { | ||
| cfg.Ordering = constants.DescendingOrdering |
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.
Why does preview mode get a different default ordering? And in particular, one that overrides whatever value the user has explicitly configured?
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.
This was just because when you first open the preview mode it always opens in descending order. When you select an item then go back to the list, it would switch which seemed jarring. I can instead get the preview mode to use the users ordering.
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.
@guyfedwards should I keep the existing functionality or update this to use the user's default sort? I can go either way imo
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 would say use the users default sort 👍
larsks
left a comment
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.
Looks good!
Please add the
hackoberfest-acceptedlabel before merging :)