0
0
Fork 0

Cover StreamEntriesController more and remove redundant instructions (#3257)

* Cover StreamEntriesController more

* Remove redundant instructions in StreamEntriesController
This commit is contained in:
Akihiko Odaki 2017-05-23 22:04:23 +09:00 committed by Eugen Rochko
parent 1d3e0a5060
commit ea2ef16ea4
2 changed files with 80 additions and 13 deletions

View file

@ -11,12 +11,8 @@ class StreamEntriesController < ApplicationController
def show
respond_to do |format|
format.html do
return gone if @stream_entry.activity.nil?
if @stream_entry.activity_type == 'Status'
@ancestors = @stream_entry.activity.reply? ? cache_collection(@stream_entry.activity.ancestors(current_account), Status) : []
@descendants = cache_collection(@stream_entry.activity.descendants(current_account), Status)
end
@ancestors = @stream_entry.activity.reply? ? cache_collection(@stream_entry.activity.ancestors(current_account), Status) : []
@descendants = cache_collection(@stream_entry.activity.descendants(current_account), Status)
end
format.atom do
@ -46,7 +42,7 @@ class StreamEntriesController < ApplicationController
@stream_entry = @account.stream_entries.where(activity_type: 'Status').find(params[:id])
@type = @stream_entry.activity_type.downcase
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil? || (@stream_entry.hidden? && (@stream_entry.activity_type != 'Status' || (@stream_entry.activity_type == 'Status' && !@stream_entry.activity.permitted?(current_account))))
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil? || (@stream_entry.hidden? && !@stream_entry.activity.permitted?(current_account))
end
def check_account_suspension