2016-10-19 03:11:36 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2013-09-28 00:07:11 +00:00
|
|
|
class ActivityStreamController < ApplicationController
|
2017-02-15 12:29:25 +00:00
|
|
|
prepend_before_action :authentication_check
|
2012-07-19 21:31:57 +00:00
|
|
|
|
2013-08-06 22:10:28 +00:00
|
|
|
# GET /api/v1/activity_stream
|
2013-09-28 00:07:11 +00:00
|
|
|
def show
|
2018-03-20 12:16:17 +00:00
|
|
|
activity_stream = current_user.activity_stream(params[:limit])
|
2012-07-19 21:31:57 +00:00
|
|
|
|
2018-03-20 12:16:17 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
assets: assets,
|
2018-03-20 12:16:17 +00:00
|
|
|
}, status: :ok
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
all = []
|
|
|
|
activity_stream.each do |item|
|
|
|
|
all.push item.attributes_with_association_ids
|
|
|
|
end
|
|
|
|
render json: all, status: :ok
|
2012-07-19 21:31:57 +00:00
|
|
|
end
|
|
|
|
|
2013-06-12 15:59:58 +00:00
|
|
|
end
|