2026-01-02 13:41:09 +00:00
|
|
|
# Copyright (C) 2012-2026 Zammad Foundation, https://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?
|
2024-04-09 14:09:18 +00:00
|
|
|
list = activity_stream.map(&:attributes_with_association_names)
|
2018-03-20 12:16:17 +00:00
|
|
|
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: {
|
2022-06-30 05:38:32 +00:00
|
|
|
record_ids: item_ids,
|
|
|
|
|
assets: assets,
|
|
|
|
|
}, status: :ok
|
2018-03-20 12:16:17 +00:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
2024-04-09 14:09:18 +00:00
|
|
|
all = activity_stream.map(&:attributes_with_association_ids)
|
2018-03-20 12:16:17 +00:00
|
|
|
render json: all, status: :ok
|
2012-07-19 21:31:57 +00:00
|
|
|
end
|
2013-06-12 15:59:58 +00:00
|
|
|
end
|