From 309904ef8f5d55611bbad31e83b726c2375eb850 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 19 Nov 2013 14:08:45 -0500 Subject: [PATCH] Revert "Merge pull request #1673 from aperrault/patch-04" This reverts commit c9ea89bdd3bf3d92264cdbd7b0b971237ce34a72, reversing changes made to 9ed49888fc6dcd2a60d8b8ef73f3508c64206dcd. --- app/controllers/list_controller.rb | 4 ---- app/models/topic_list.rb | 6 +----- app/serializers/topic_list_serializer.rb | 6 +----- lib/guardian.rb | 4 +--- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 101165396..3b56132a7 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -11,9 +11,6 @@ class ListController < ApplicationController user = list_target_user list = TopicQuery.new(user, list_opts).public_send("list_#{filter}") list.more_topics_url = construct_url_with(filter, list_opts) - if list_opts.include?(:category) - list.category = Category.where(name: list_opts[:category]).first - end if [:latest, :hot].include?(filter) @description = SiteSetting.site_description @rss = filter @@ -54,7 +51,6 @@ class ListController < ApplicationController query = TopicQuery.new(current_user, list_opts) list = query.list_latest list.more_topics_url = construct_url_with(:latest, list_opts) - list.category = @category if @category respond(list) end diff --git a/app/models/topic_list.rb b/app/models/topic_list.rb index f782ed650..0d8ed9ca0 100644 --- a/app/models/topic_list.rb +++ b/app/models/topic_list.rb @@ -47,11 +47,7 @@ class TopicList end def attributes - hash = {'more_topics_url' => page} - if @category.present? - hash['category'] = @category - end - hash + {'more_topics_url' => page} end def has_rank_details? diff --git a/app/serializers/topic_list_serializer.rb b/app/serializers/topic_list_serializer.rb index 9c81c445c..282786cc5 100644 --- a/app/serializers/topic_list_serializer.rb +++ b/app/serializers/topic_list_serializer.rb @@ -18,11 +18,7 @@ class TopicListSerializer < ApplicationSerializer end def can_create_topic - if object.category.present? - scope.can_create?(Topic, object.category) - else - scope.can_create?(Topic) - end + scope.can_create?(Topic) end def include_more_topics_url? diff --git a/lib/guardian.rb b/lib/guardian.rb index 10fc23337..0d1806ebe 100644 --- a/lib/guardian.rb +++ b/lib/guardian.rb @@ -244,9 +244,7 @@ class Guardian end def can_create_topic?(parent) - user && - user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i && - can_create_post?(parent) + user && user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i && can_create_post?(parent) end def can_create_topic_on_category?(category)