trabajo-afectivo/app/controllers/activity_stream_controller.rb

41 lines
937 B
Ruby
Raw Normal View History

2016-10-19 03:11:36 +00:00
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
2013-09-28 00:07:11 +00:00
class ActivityStreamController < ApplicationController
prepend_before_action :authentication_check
# GET /api/v1/activity_stream
2013-09-28 00:07:11 +00:00
def show
activity_stream = current_user.activity_stream(params[:limit])
if response_expand?
list = []
activity_stream.each do |item|
list.push item.attributes_with_association_names
end
render json: list, status: :ok
return
end
if response_full?
assets = {}
item_ids = []
activity_stream.each do |item|
item_ids.push item.id
assets = item.assets(assets)
end
render json: {
record_ids: item_ids,
assets: assets,
}, status: :ok
return
end
all = []
activity_stream.each do |item|
all.push item.attributes_with_association_ids
end
render json: all, status: :ok
end
end