2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
2015-11-16 10:44:13 +00:00
|
|
|
|
|
|
|
class ChatsController < ApplicationController
|
2020-03-19 09:39:51 +00:00
|
|
|
prepend_before_action { authentication_check && authorize! }
|
2015-11-16 10:44:13 +00:00
|
|
|
|
|
|
|
def index
|
|
|
|
chat_ids = []
|
|
|
|
assets = {}
|
2017-10-01 12:25:52 +00:00
|
|
|
Chat.order(:id).each do |chat|
|
2015-11-16 10:44:13 +00:00
|
|
|
chat_ids.push chat.id
|
|
|
|
assets = chat.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2015-11-25 22:24:08 +00:00
|
|
|
setting = Setting.find_by(name: 'chat')
|
|
|
|
assets = setting.assets(assets)
|
2015-11-16 10:44:13 +00:00
|
|
|
render json: {
|
|
|
|
chat_ids: chat_ids,
|
2018-12-19 17:31:51 +00:00
|
|
|
assets: assets,
|
2015-11-16 10:44:13 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
model_show_render(Chat, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
model_create_render(Chat, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
model_update_render(Chat, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2016-11-30 10:30:03 +00:00
|
|
|
model_destroy_render(Chat, params)
|
2015-11-16 10:44:13 +00:00
|
|
|
end
|
2016-08-12 16:39:09 +00:00
|
|
|
|
2015-11-16 10:44:13 +00:00
|
|
|
end
|