]>
cat aescling's git repositories - mastodon.git/blob - app/controllers/stream_entries_controller.rb
1 # frozen_string_literal: true
3 class StreamEntriesController
< ApplicationController
5 include SignatureVerification
9 before_action
:set_account
10 before_action
:set_stream_entry
11 before_action
:set_link_headers
12 before_action
:check_account_suspension
13 before_action
:set_cache_headers
16 respond_to
do |format
|
18 redirect_to
short_account_status_url(params
[:account_username], @stream_entry.activity
) if @type == 'status'
22 unless @stream_entry.hidden
?
24 expires_in
3.minutes
, public
: true
27 render xml
: OStatus
::AtomSerializer.render(OStatus
::AtomSerializer.new
.entry(@stream_entry, true))
33 redirect_to
embed_short_account_status_url(@account, @stream_entry.activity
), status
: 301
39 @account = Account
.find_local!
(params
[:account_username])
43 response
.headers
['Link'] = LinkHeader
.new(
45 [account_stream_entry_url(@account, @stream_entry, format
: 'atom'), [%w(rel alternate
), %w(type application
/atom+xml
)]],
46 [ActivityPub
::TagManager.instance
.uri_for(@stream_entry.activity
), [%w(rel alternate
), %w(type application
/activity+json
)]],
52 @stream_entry = @account.stream_entries
.where(activity_type
: 'Status').find(params
[:id])
53 @type = @stream_entry.activity_type
.downcase
55 raise ActiveRecord
::RecordNotFound if @stream_entry.activity
.nil?
56 authorize
@stream_entry.activity
, :show? if @stream_entry.hidden
?
57 rescue Mastodon
::NotPermittedError
58 # Reraise in order to get a 404
59 raise ActiveRecord
::RecordNotFound
62 def check_account_suspension
63 gone
if @account.suspended
?
This page took 0.084395 seconds and 4 git commands to generate.