From a08e724476f47b85de9bb334eeadaf882a7a23ee Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 25 Mar 2016 02:13:30 +0100 Subject: Fix subscriptions:clear task, refactor feeds, refactor streamable activites and atom feed generation to some extent, as well as the way mentions are stored --- app/controllers/accounts_controller.rb | 4 ++-- app/controllers/api/statuses_controller.rb | 6 ++---- app/controllers/statuses_controller.rb | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 2bd0fb566..f4073d093 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -11,8 +11,8 @@ class AccountsController < ApplicationController format.atom do @entries = @account.stream_entries.order('id desc').with_includes.paginate_by_max_id(20, params[:max_id] || nil) - ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Status' }, activity: [:mentioned_accounts, reblog: :account, thread: :account]) - ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Favourite' }, activity: [:account, :thread, :mentioned_accounts]) + ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Status' }, activity: [:mentions, reblog: :account, thread: :account]) + ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Favourite' }, activity: [:account, :status]) ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Follow' }, activity: :target_account) end end diff --git a/app/controllers/api/statuses_controller.rb b/app/controllers/api/statuses_controller.rb index ba216a7b3..579c3b893 100644 --- a/app/controllers/api/statuses_controller.rb +++ b/app/controllers/api/statuses_controller.rb @@ -22,12 +22,10 @@ class Api::StatusesController < ApiController end def home - feed = Feed.new(:home, current_user.account) - @statuses = feed.get(20, params[:max_id] || '+inf') + @statuses = Feed.new(:home, current_user.account).get(20, params[:max_id]) end def mentions - feed = Feed.new(:mentions, current_user.account) - @statuses = feed.get(20, params[:max_id] || '+inf') + @statuses = Feed.new(:mentions, current_user.account).get(20, params[:max_id]) end end diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index a5cb3eae1..99f3e5079 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -4,7 +4,7 @@ class StatusesController < ApplicationController before_action :authenticate_user! def create - status = PostStatusService.new.(current_user.account, status_params[:text]) + PostStatusService.new.(current_user.account, status_params[:text]) redirect_to root_path rescue ActiveRecord::RecordInvalid redirect_to root_path -- cgit