|
|
@ -3,6 +3,8 @@ class StreamEntriesController < ApplicationController |
|
|
|
|
|
|
|
before_action :set_account |
|
|
|
before_action :set_stream_entry |
|
|
|
before_action :authenticate_user!, only: [:reblog, :favourite] |
|
|
|
before_action :only_statuses!, only: [:reblog, :favourite] |
|
|
|
|
|
|
|
def show |
|
|
|
@type = @stream_entry.activity_type.downcase |
|
|
@ -13,6 +15,16 @@ class StreamEntriesController < ApplicationController |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def reblog |
|
|
|
ReblogService.new.(current_user.account, @stream_entry.activity) |
|
|
|
redirect_to root_path |
|
|
|
end |
|
|
|
|
|
|
|
def favourite |
|
|
|
FavouriteService.new.(current_user.account, @stream_entry.activity) |
|
|
|
redirect_to root_path |
|
|
|
end |
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
def set_account |
|
|
@ -22,4 +34,8 @@ class StreamEntriesController < ApplicationController |
|
|
|
def set_stream_entry |
|
|
|
@stream_entry = @account.stream_entries.find(params[:id]) |
|
|
|
end |
|
|
|
|
|
|
|
def only_statuses! |
|
|
|
redirect_to root_url unless @stream_entry.activity_type == 'Status' |
|
|
|
end |
|
|
|
end |