about summary refs log tree commit diff
path: root/app/controllers/tags_controller.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-13 15:16:02 +0100
committerThibaut Girka <thib@sitedethib.com>2019-03-13 15:16:02 +0100
commit02062aab55cb6f8da527998a210775c2ad695eed (patch)
treeab606ee84d964f28dad5bc77cfbd49b5c12849fa /app/controllers/tags_controller.rb
parentc2857c976c7d4a8bbd02c3c18569913f2bf8a034 (diff)
parent06663fcf87fe0d6bc71336e6f212b82f098066d7 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/controllers/about_controller.rb
- app/controllers/tags_controller.rb
- app/views/about/show.html.haml
- spec/views/about/show.html.haml_spec.rb
Diffstat (limited to 'app/controllers/tags_controller.rb')
-rw-r--r--app/controllers/tags_controller.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 186d276c2..5cb048c1a 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -9,13 +9,15 @@ class TagsController < ApplicationController
   before_action :set_instance_presenter
 
   def show
-    @tag = Tag.find_by!(name: params[:id].downcase)
+    @tag = Tag.find_normalized!(params[:id])
 
     respond_to do |format|
       format.html do
         use_pack 'about'
-        serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer)
-        @initial_state_json   = serializable_resource.to_json
+        @initial_state_json = ActiveModelSerializers::SerializableResource.new(
+          InitialStatePresenter.new(settings: {}, token: current_session&.token),
+          serializer: InitialStateSerializer
+        ).to_json
       end
 
       format.rss do
@@ -26,8 +28,7 @@ class TagsController < ApplicationController
       end
 
       format.json do
-        @statuses = HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, params[:local])
-                                       .paginate_by_max_id(PAGE_SIZE, params[:max_id])
+        @statuses = HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, params[:local]).paginate_by_max_id(PAGE_SIZE, params[:max_id])
         @statuses = cache_collection(@statuses, Status)
 
         render json: collection_presenter,
@@ -56,11 +57,4 @@ class TagsController < ApplicationController
       items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
     )
   end
-
-  def initial_state_params
-    {
-      settings: {},
-      token: current_session&.token,
-    }
-  end
 end