Slice 3: Chat History Review (Polish)
Blocked
Task
Low
Description
## Overview
Add chat transcript review capability for ended sessions. Operators and admins can review past chat conversations.
## Verification (How to test after deployment)
1. View any ended session with chat messages
2. See "Chat History" collapsible section below timeline
3. Expand to see full conversation
4. Messages show participant name, content, and timestamp
5. (Optional) Click export to download transcript
## Implementation Scope
### 1. Session Detail Component Update
Add new collapsible card section:
```haml
.card.bg-base-200.mt-2
.card-body
%button.card-title.cursor-pointer{ data-action: "click->ui-animate#toggle" }
История чата
%span.badge.badge-sm= @session.support_session_messages.count
.chat-history{ data-ui-animate-target: "content" }
- if @session.support_session_messages.any?
- @session.support_session_messages.chronological.each do |msg|
.chat{ class: msg.operator? ? 'chat-end' : 'chat-start' }
.chat-header
= msg.participant_name
%time.text-xs.opacity-50= l(msg.created_at, format: :short)
.chat-bubble{ class: msg.operator? ? 'chat-bubble-primary' : '' }
= msg.content
- else
.text-center.text-base-content.opacity-50.py-4
Нет сообщений в этой сессии
```
### 2. (Optional) Export Functionality
Add transcript export:
- Plain text format
- JSON format option
- Download via button
```ruby
def export_chat
@session = SupportSession.find(params[:id])
authorize! @session, to: :show?, with: RemoteSupportPolicy
messages = @session.support_session_messages.chronological
respond_to do |format|
format.text { render plain: format_as_text(messages) }
format.json { render json: messages.map(&:to_broadcast_payload) }
end
end
```
## Files to Modify
- `app/components/remote_support/session_detail_component.rb` (add messages helper)
- `app/components/remote_support/session_detail_component.html.haml` (add section)
- `app/controllers/remote_support_sessions_controller.rb` (optional export)
- `config/routes.rb` (optional export route)
- `spec/components/remote_support/session_detail_component_spec.rb`
Working Memory
{
"blocked_reason": "Waiting for dependencies: 110"
}
Ticket Stats
Status:
Blocked
Priority:
Low
Type:
Task
Comments
0 commentsAdd a Comment
No Subtasks Yet
Break down this ticket into smaller, manageable subtasks