From efe0e8a6bd6a912ea6298d2e41478018d0464736 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 26 Jun 2022 15:39:46 -0500 Subject: [PATCH] ai tags: default to showing only posts, not media assets. Change the /ai_tags page to show only posts by default, not both posts and unposted media assets mixed together. Showing media assets tended to confuse users about why they couldn't add tags to these images. It also distracted from the page's primary use case, which is gardening posts. --- app/controllers/ai_tags_controller.rb | 1 + app/views/ai_tags/index.html.erb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/ai_tags_controller.rb b/app/controllers/ai_tags_controller.rb index 15e4c7b68..b02616ba0 100644 --- a/app/controllers/ai_tags_controller.rb +++ b/app/controllers/ai_tags_controller.rb @@ -7,6 +7,7 @@ class AITagsController < ApplicationController limit = params[:limit].presence || CurrentUser.user.per_page @mode = params.fetch(:mode, "gallery") @preview_size = params[:size].presence || cookies[:post_preview_size].presence || MediaAssetGalleryComponent::DEFAULT_SIZE + params[:search][:is_posted] ||= "true" if request.format.html? @ai_tags = authorize AITag.visible(CurrentUser.user).paginated_search(params, limit: limit, count_pages: false) @ai_tags = @ai_tags.includes(:media_asset, :tag, :post) if request.format.html? diff --git a/app/views/ai_tags/index.html.erb b/app/views/ai_tags/index.html.erb index 3e7be795f..7c775f11c 100644 --- a/app/views/ai_tags/index.html.erb +++ b/app/views/ai_tags/index.html.erb @@ -14,7 +14,6 @@ <% end %>
- <%= link_to "All", current_page_path(search: search_params.to_h.without("is_posted")), class: ["inline-block p-1 pb-2", (search_params[:is_posted].nil? ? "border-current border-b-2 -mb-px" : "inactive-link")] %> <%= link_to "Posted", current_page_path(search: search_params.merge(is_posted: true)), class: ["inline-block p-1 pb-2", (search_params[:is_posted].to_s.truthy? ? "border-current border-b-2 -mb-px" : "inactive-link")] %> <%= link_to "Unposted", current_page_path(search: search_params.merge(is_posted: false)), class: ["inline-block p-1 pb-2", (search_params[:is_posted].to_s.falsy? ? "border-current border-b-2 -mb-px" : "inactive-link")] %>