From 027f1f2b5303b9d93ac9f9cdfa220fbf8e4d01f7 Mon Sep 17 00:00:00 2001 From: Lee Lawlor Date: Wed, 28 May 2014 12:17:17 -0400 Subject: [PATCH] don't show social channels in API requests --- app/controllers/channels_controller.rb | 4 ++-- app/models/channel.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index 11fea97..aa83f02 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -141,8 +141,8 @@ class ChannelsController < ApplicationController @channels = current_user.channels respond_to do |format| format.html - format.json { render :json => @channels.to_json(Channel.private_options) } - format.xml { render :xml => @channels.to_xml(Channel.private_options) } + format.json { render :json => @channels.not_social.to_json(Channel.private_options) } + format.xml { render :xml => @channel.not_socials.to_xml(Channel.private_options) } end end diff --git a/app/models/channel.rb b/app/models/channel.rb index 3814a87..cdc2f6b 100644 --- a/app/models/channel.rb +++ b/app/models/channel.rb @@ -74,6 +74,7 @@ class Channel < ActiveRecord::Base validates :video_type, :presence => true, :if => lambda{ |channel| !channel.video_id.nil? && !channel.video_id.empty?} scope :public_viewable, lambda { where("public_flag = true AND social != true") } + scope :not_social, lambda { where("social != true") } scope :is_public, lambda { where("public_flag = true") } scope :active, lambda { where("channels.last_entry_id > 1 and channels.updated_at > ?", DateTime.now.utc - 7.day) } scope :being_cleared, lambda { where("clearing = true") }