2019-05-13 10:37:49 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-07-13 14:36:16 -05:00
|
|
|
class DiscourseChatIntegration::PublicController < ApplicationController
|
|
|
|
requires_plugin DiscourseChatIntegration::PLUGIN_NAME
|
2017-07-24 16:13:53 +01:00
|
|
|
|
|
|
|
def post_transcript
|
|
|
|
params.require(:secret)
|
|
|
|
|
2017-10-03 17:42:07 +08:00
|
|
|
redis_key = "chat_integration:transcript:#{params[:secret]}"
|
2019-12-03 10:45:32 +01:00
|
|
|
content = Discourse.redis.get(redis_key)
|
2017-07-24 16:13:53 +01:00
|
|
|
|
|
|
|
if content
|
2017-08-01 20:53:39 +01:00
|
|
|
render json: { content: content }
|
2017-10-03 17:42:07 +08:00
|
|
|
else
|
|
|
|
raise Discourse::NotFound
|
2017-07-24 16:13:53 +01:00
|
|
|
end
|
|
|
|
end
|
2017-08-01 20:53:39 +01:00
|
|
|
end
|