Files
overleaf-cep/services/chat/chat.yaml
Domagoj Kriskovic 7a46cb5c03 Support for deleting and editing chat messages (#28204)
* Initial server-side delete of chat message plus dropdown

* Update chat pane after deleting message

* Chat message dropdown styling

* Add confirmation dialog for deleting a message

* Refactor chat message grouping to allow deletion of individual messages

* Delete other user's deleted message from chat pane

* Implement message editing

* Styling

* Make the dropdown appear overlap with the button slightly so that the menu stays visible when the user moves their cursor into the menu when the menu is positioned above the button

* Submit edit with Enter key

* Add edited indicator to edited chat messages

* Add animation to chat message deletion

* Tidying, edit chat message textarea improvements

* Add types to message-list-utils

* update dependencies

* edit/delete for ide-redesign

* fix type errors in tests

* filter deleted messages from group

* promisify ChatController

* fix tests and translations

* add new tests

* chat-context tests

* fix message-list-appender tests

* add new tests for message-list-utils

* Update services/web/test/frontend/features/chat/context/chat-context.test.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* preserve original content when canceling edits

* update delete message translation

* hide dropdown only if not already shown

* remove delete animation

* fix lint error

* fix chat.yaml

* hide under feature flag

---------

Co-authored-by: Tim Down <158919+timdown@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
GitOrigin-RevId: 12521886a1a59ccd564851df19e5d46c70d328f5
2025-10-02 08:05:58 +00:00

504 lines
13 KiB
YAML

openapi: 3.1.0
x-stoplight:
id: okoe8mh50pjec
info:
title: chat
version: '1.0'
servers:
- url: 'http://chat:3010'
x-exegesis-controller: messagesController
paths:
'/project/{projectId}/messages':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
get:
summary: Get Global messages
tags: []
responses:
'201':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Message'
operationId: getGlobalMessages
description: Get global messages for the project with Project ID provided
parameters:
- schema:
type: string
in: query
name: before
- schema:
type: string
in: query
name: limit
post:
summary: Send Global message
operationId: sendGlobalMessage
responses:
'201':
description: OK
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
examples:
example-1:
value:
user_id: string
content: string
description: 'UserID and Content of the message to be posted. '
description: Send global message for the project with Project ID provided
'/project/{projectId}/messages/{messageId}':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: messageId
in: path
required: true
get:
summary: Get single global message
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'404':
description: Message not found
operationId: getGlobalMessage
description: Get a single global message by message ID for the project with Project ID provided
delete:
summary: Delete global message
operationId: deleteGlobalMessage
responses:
'204':
description: No Content
description: 'Delete global message'
'/project/{projectId}/thread/{threadId}/messages':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
post:
summary: Send message
operationId: sendMessage
responses:
'201':
description: Created
description: Add a message to the thread with thread ID provided from the Project with Project ID provided.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
description: |-
JSON object with :
- user_id: Id of the user
- content: Content of the message
'/project/{projectId}/threads':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
get:
summary: Get Threads
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Thread'
examples: {}
'404':
description: Not Found
operationId: getThreads
description: Get the list of threads for the project with Project ID provided
'/project/{projectId}/thread/{threadId}/messages/{messageId}/edit':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
- schema:
type: string
name: messageId
in: path
required: true
post:
summary: Edit message
operationId: editMessage
responses:
'204':
description: No Content
'404':
description: Not Found
requestBody:
content:
application/json:
schema:
type: object
properties:
content:
type: string
user_id:
type: string
readOnly: true
required:
- content
examples: {}
description: |-
JSON object with :
- content: Content of the message to edit
- user_id: Id of the user (optional)
description: |
Update message with Message ID provided from the Thread ID and Project ID provided
'/project/{projectId}/messages/{messageId}/edit':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: messageId
in: path
required: true
post:
summary: Edit global message
operationId: editGlobalMessage
responses:
'204':
description: No Content
'404':
description: Not Found
requestBody:
content:
application/json:
schema:
type: object
properties:
content:
type: string
user_id:
type: string
readOnly: true
required:
- content
examples: {}
description: |-
JSON object with :
- content: Content of the message to edit
- user_id: Id of the user (optional)
description: |
Update global message with Message ID provided from the Project ID provided
'/project/{projectId}/thread/{threadId}/messages/{messageId}':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
- schema:
type: string
name: messageId
in: path
required: true
delete:
summary: Delete message
operationId: deleteMessage
responses:
'204':
description: No Content
description: 'Delete message with Message ID provided, from the Thread with ThreadID and ProjectID provided'
'/project/{projectId}/thread/{threadId}/user/{userId}/messages/{messageId}':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
- schema:
type: string
name: userId
in: path
required: true
- schema:
type: string
name: messageId
in: path
required: true
delete:
summary: Delete message written by a given user
operationId: deleteUserMessage
responses:
'204':
description: No Content
'/project/{projectId}/thread/{threadId}/resolve':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
post:
summary: Resolve Thread
operationId: resolveThread
responses:
'204':
description: No Content
requestBody:
content:
application/json:
schema:
type: object
properties:
user_id:
type: string
required:
- user_id
description: |-
JSON object with :
- user_id: Id of the user.
description: Mark Thread with ThreadID and ProjectID provided owned by the user with UserID provided as resolved.
'/project/{projectId}/thread/{threadId}/reopen':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
post:
summary: Reopen Thread
operationId: reopenThread
responses:
'204':
description: No Content
description: |-
Reopen Thread with ThreadID and ProjectID provided.
i.e unmark it as resolved.
'/project/{projectId}/thread/{threadId}':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
- schema:
type: string
name: threadId
in: path
required: true
get:
summary: Get Thread
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Thread'
'404':
description: Thread not found
operationId: getThread
description: Get a thread with ThreadID and ProjectID provided
delete:
summary: Delete thread
operationId: deleteThread
responses:
'204':
description: No Content
description: Delete thread with ThreadID and ProjectID provided
'/project/{projectId}/resolved-thread-ids':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
get:
summary: Get resolved thread ids
operationId: getResolvedThreadIds
responses:
'200':
description: Resolved thread ids
'/project/{projectId}':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
delete:
summary: Destroy project
operationId: destroyProject
responses:
'204':
description: No Content
description: 'Delete all threads from Project with Project ID provided, and all messages in those threads.'
/status:
get:
summary: Check status
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: string
description: chat is alive
operationId: getStatus
description: Check that the Chat service is alive
head:
summary: Check status
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: string
description: chat is alive
operationId: getStatus
description: Check that the Chat service is alive
'/project/{projectId}/duplicate-comment-threads':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
post:
summary: Duplicate comment threads
operationId: duplicateCommentThreads
requestBody:
content:
application/json:
schema:
type: object
properties:
threads:
type: array
items:
type: string
responses:
'200':
content:
application/json:
schema:
type: object
properties:
newThreads:
type: object
description: Mapping of old thread ids to their duplicated thread ids
description: Duplicate a list of comment threads
'/project/{projectId}/generate-thread-data':
parameters:
- schema:
type: string
name: projectId
in: path
required: true
post:
summary: Generate thread data to load into the frontend
operationId: generateThreadData
requestBody:
content:
application/json:
schema:
type: object
properties:
threads:
type: array
items:
type: string
responses:
'200':
content:
application/json:
schema:
type: object
description: Load threads and generate a json blob containing all messages in all the threads
components:
schemas:
Message:
title: Message
x-stoplight:
id: ue9n1vvezlutw
type: object
examples:
- user_id: string
- content: string
properties:
user_id:
type: string
content:
type: string
required:
- user_id
- content
Thread:
title: Thread
x-stoplight:
id: 0ppt3jw4h5bua
type: array
items:
$ref: '#/components/schemas/Message'