From 79e8596332b157f900c5ffef68cd4fb1633b0ac2 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 27 Aug 2020 09:19:55 +0800 Subject: [PATCH] Make rubocop happy. --- app/controllers/data_explorer/query_controller.rb | 6 ++++-- app/models/data_explorer/query.rb | 1 - app/models/data_explorer/query_group.rb | 1 - app/serializers/data_explorer/query_serializer.rb | 3 ++- app/serializers/data_explorer/small_badge_serializer.rb | 2 ++ .../data_explorer/small_post_with_excerpt_serializer.rb | 2 ++ 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/data_explorer/query_controller.rb b/app/controllers/data_explorer/query_controller.rb index c8da839..3fe782b 100644 --- a/app/controllers/data_explorer/query_controller.rb +++ b/app/controllers/data_explorer/query_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DataExplorer::QueryController < ::ApplicationController requires_plugin DataExplorer.plugin_name @@ -18,7 +20,7 @@ class DataExplorer::QueryController < ::ApplicationController query.name = attributes["name"] query.description = attributes["description"] query.user_id = Discourse::SYSTEM_USER_ID.to_s - queries << query + queries << query end render_serialized queries, DataExplorer::QuerySerializer, root: 'queries' @@ -48,7 +50,7 @@ class DataExplorer::QueryController < ::ApplicationController queries = DataExplorer::Query .where(hidden: false) .joins("INNER JOIN data_explorer_query_groups - ON data_explorer_query_groups.query_id = data_explorer_queries.id + ON data_explorer_query_groups.query_id = data_explorer_queries.id AND data_explorer_query_groups.group_id = #{@group.id}") render_serialized(queries, DataExplorer::QuerySerializer, root: 'queries') end diff --git a/app/models/data_explorer/query.rb b/app/models/data_explorer/query.rb index 9f09369..d64db4b 100644 --- a/app/models/data_explorer/query.rb +++ b/app/models/data_explorer/query.rb @@ -37,4 +37,3 @@ module DataExplorer end end end - diff --git a/app/models/data_explorer/query_group.rb b/app/models/data_explorer/query_group.rb index 800078f..cd59885 100644 --- a/app/models/data_explorer/query_group.rb +++ b/app/models/data_explorer/query_group.rb @@ -8,4 +8,3 @@ module DataExplorer belongs_to :group end end - diff --git a/app/serializers/data_explorer/query_serializer.rb b/app/serializers/data_explorer/query_serializer.rb index a34013e..634c8f8 100644 --- a/app/serializers/data_explorer/query_serializer.rb +++ b/app/serializers/data_explorer/query_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DataExplorer::QuerySerializer < ActiveModel::Serializer attributes :id, :sql, :name, :description, :param_info, :created_at, :username, :group_ids, :last_run_at, :hidden, :user_id @@ -13,4 +15,3 @@ class DataExplorer::QuerySerializer < ActiveModel::Serializer object.groups.map(&:id) end end - diff --git a/app/serializers/data_explorer/small_badge_serializer.rb b/app/serializers/data_explorer/small_badge_serializer.rb index 72cb1b1..416e1b3 100644 --- a/app/serializers/data_explorer/small_badge_serializer.rb +++ b/app/serializers/data_explorer/small_badge_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DataExplorer::SmallBadgeSerializer < ApplicationSerializer attributes :id, :name, :badge_type, :description, :icon end diff --git a/app/serializers/data_explorer/small_post_with_excerpt_serializer.rb b/app/serializers/data_explorer/small_post_with_excerpt_serializer.rb index 9ef676a..1ee7753 100644 --- a/app/serializers/data_explorer/small_post_with_excerpt_serializer.rb +++ b/app/serializers/data_explorer/small_post_with_excerpt_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DataExplorer::SmallPostWithExcerptSerializer < ApplicationSerializer attributes :id, :topic_id, :post_number, :excerpt, :username, :avatar_template def excerpt