Skip to content
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

If preferred_instance= is missing, default to preferred instance stored in cookie #17

Closed
rcmaehl opened this issue Jul 3, 2023 · 1 comment · Fixed by #27
Closed
Assignees
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@rcmaehl
Copy link
Contributor

rcmaehl commented Jul 3, 2023

Is your feature request related to a problem? Please describe.

I'd like to be able to link users to a specific query and have it use their preferred instance for the search. E.g.

https://search-lemmy.com/results?query=lemmyverse

Describe the solution you'd like

Per our discord conversation, the preferred instance is stored as a cookie.

If the cookie is missing and the above URL is used, potentially drop them on the homepage with the query already filled(?)

Describe alternatives you've considered

Prompting the user every time - Seems excessive
Defaulting to Lemmy.world - This is bad practice, even if everyone else is currently doing it

Additional context

@marsara9 marsara9 added the enhancement New feature or request label Jul 3, 2023
@marsara9
Copy link
Owner

marsara9 commented Jul 3, 2023

Currently the preferred-instance is stored as a cookie. This query parameter can be completely drop and the value can just be read from the cookie directly.

References: https://github.com/marsara9/lemmy-search/blob/master/ui/results/results.js#L214
https://github.com/marsara9/lemmy-search/blob/master/ui/results/results.js#L10

So on line 10 above, instead of just copying the query that was passed to /results directly, the query string will just need to be re-constructed and the preferred instance determined by what's stored in the cookie instead of what was passed in the query string.

@marsara9 marsara9 added bug Something isn't working good first issue Good for newcomers labels Jul 3, 2023
@marsara9 marsara9 self-assigned this Jul 6, 2023
marsara9 added a commit that referenced this issue Jul 6, 2023
…nstance as a query parameter. The value is read directly from the user's cookie and then passed to the /search endpoint.

This should make it easier to share search URLs and hopefully fix the nullpost bug.
@marsara9 marsara9 linked a pull request Jul 6, 2023 that will close this issue
@marsara9 marsara9 closed this as completed Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants