-
Notifications
You must be signed in to change notification settings - Fork 7
Add default saved search #127
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,11 @@ class TopicsController < ApplicationController | |
| ROW_STATES_LIMIT = 50 | ||
|
|
||
| def index | ||
| if user_signed_in? && request.format.html? && params[:cursor].blank? && params[:commit].blank? | ||
| default_search = current_user.default_saved_search | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the default view showing everything very difficult to access, we should have an easy way (button/link) that brings users back to the. We can also get a ui-issue that since the default search is a saved search, it will show up as a badge at the top, where you can click on the "X" button that redirect to the index, which will redirect back again to the same saved search. Maybe one solution could be that we make the root "/" URL dependent on this (maybe even make / explicitly redirect to /topics or the saved search), and that way clicking on the hackorum logo always would bring up the user's preferred home page, while clicking on topics will always bring up the entire index? |
||
| return redirect_to search_topics_path(saved_search_id: default_search.id) if default_search | ||
| end | ||
|
|
||
| @search_query = nil | ||
| base_query = Topic.includes(*TOPIC_LIST_PRELOADS) | ||
| base_query = apply_default_ignore_filter(base_query) if user_signed_in? | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| class AddDefaultToSavedSearchPreferences < ActiveRecord::Migration[8.0] | ||
| def change | ||
| add_column :saved_search_preferences, :default, :boolean, default: false, null: false | ||
|
|
||
| add_index :saved_search_preferences, :user_id, | ||
| unique: true, | ||
| where: '"default" = true', | ||
| name: "idx_one_default_saved_search_per_user" | ||
| end | ||
| end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
either this has to restrict selection to non-team saved searches, or the redirect has to handle adding the team id