Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat feature #163

Open
Julien-Dubois-eXo opened this issue Oct 8, 2024 · 13 comments
Open

Chat feature #163

Julien-Dubois-eXo opened this issue Oct 8, 2024 · 13 comments

Comments

@Julien-Dubois-eXo
Copy link

Julien-Dubois-eXo commented Oct 8, 2024

Rationale

The Meeds software doesn't provide a chat feature yet.
Yet, it is sometimes expected by users willing to:

  • engage conversations with other people within their Meeds Hub
  • avoid having different tools to discuss the project
  • centralize access to knowledge and informations

Hence, the minimum is providing a chat option to users so they can:

  • discuss with one other user (1:1)
  • discuss with a group of people

1. Functional Requirements

Top User Stories

Bridge with third party chat

Thanks to the ability to create a bridge between the matrix server and the third party chat.

As a user,

  • from the platform chat, I can find my conversation and messages sent using a third party chat
  • I can send messages using the platform chat and then, find them in the third party chat

Data storage
As a user, I can only go back one year in a chat conversation.
The data are deleted before that.

Conversation list
As a user, when I open the chat, I have:

  • my avatar with my status. I can change it for: Available, Do not disturb, Invisible, Away
  • create a 1:1 conversation by searching for a user
  • a filter option to filter by the name of the conversation
  • the list of conversations displaying:
    • the user information (rounded avatar, display name) for 1:1 conversation. If the user is connected its status is displayed too
    • the space information (square avatar, display name) for space conversation
    • the last message sent in the conversation
    • the date of the last message

The chat drawer displays at least 10 conversations before displaying a load more button. However, if the screen size is higher then I display as much as the screen size can before the load more.

When I have an unread conversation

  • a numeric indicator is displayed next to the room name to let me know how many messages I have not read.
  • In case of more than 99 messages, the indicator will be 99+
  • the last message is displayed in bold to highlight the conversation

I have no expand mode for the chat.
Image

Conversation
As a user, when I access a chat, the second level drawer opens with following behaviour:

  • the user information (avatar and name) for a 1:1 conversation. Clicking on it sends me to the user profile in the same tab
  • the space information (avatar and name) for a space conversation. Clicking on it sends me to the space in the same tab
  • the conversation composed of the different messages with their time stamps

When I go up in the conversation, an option is suggested so I can jump to the most recent message.
I can go back to the conversations list thanks to a back arrow.

Write a message
I can write messages with emoji (from emoji bank as in the feed) in the body and text

  • the redaction area is dynamic and increases according to the message size
  • After the first chars are written a button is displayed to send the message. On desktop, I can also press "Enter" on the keyboard.
  • I can add a line break by pressing "Alt+Enter" on the desktop. On mobile, the "Enter" key adds a line break.
  • Scrolling up when I'm writing a message reduces the redaction area to only one line. On mobile it hides the keyboard too.

I can send images by clicking on a button or by doing a copy/paste or a drag and drop on the conversation.

  • Same component as in the feed. I select the image in the file browser and it's sent directly. No possibility to edit the image to crop it.
  • By clicking on it, I display the viewer.
  • Pasting an image URL, paste only the URL. No link preview.

The message has the following layout to help the readability:

  • My message: color #0a7cff
  • User I'm talking to:
    • color grey lightened
    • 1:1 conversation: no avatar or name
    • space conversation:
      • avatar and name of users (on 1 line max, ellipsis if longer)
      • messages are grouped if it's the same user that sent them and the user information is displayed only once

Each message has a timestamp of the time. On hovering over I have the full date on a tooltip. If several messages are sent by the same user during the same minute, the time stamp is only on the last message and they are grouped together.
When the messages are sent on a different day, a time stamp separates the messages to let the user know the batch of messages by day

image

Impacts

Gamification

No impact

Notifications

Analytics

Measuring point "Send a message" to be adapt to track the actions on the new drawer.

Unified Search

2. Technical Requirements

Expected Volume & Performance

Security

Authentication & Authorizations
Matrix is an external server that provides APIs to interact with. All communication (API calls) should be secured with a token related to a user session. This session should be active (Not expired, not logged out, etc ...)

For the integration with Meeds, we will need to authenticate the user to Matrix server and get the access_token that will be used later to authenticate API calls

Administrative actions : This will require an access_token that could be generated once (session never expires). This token will be registered on server side using a System property. It could be improved to be registered using an administration UI.
User actions : This requires that the user log into Meeds and into Matrix simultaneously to get a fresh access token, and use it for the different user action during a chat session. This token will be registered on the browser storage and should be be expired/removed when the user session is expired. Generating the access_token could be done with one of the following authentication methods, in our case we will use JWT to provide the best UX for users.
Storage of Access token
Once retrieved The access token should be stored to avoid re-sending authentication requests. The token will be stored in the local storage of the browser

Data retention :
Each message should be kept for 1 year, This could be done using a server configuration

Extensibility

It is needed to add an extension point that could be used for displaying Call actions (Jitsi, etc ...) and other possible actions on the head of conversation

Configurability

New configuration introduced for :

  • meeds.matrix.server.url : Matrix Server URL
  • meeds.matrix.user.name : The username of the Administrator account on Matrix
  • meeds.matrix.shared_secret_registration : the registration token is named shared_secret_registration , it is used for creating new user accounts from Meeds server inside Matrix server.

Existing Features

Feature Flags

The Matrix addon will be a new addon that will have its own version history, thus we may install it whenever we want. No feature flag needed.

Other Non Functional Requirements

3. Impacts

Documentation

Installation guides should be updated for instructions to install the Matrix stack.

Training

No

4. Software Architecture

Security

Access

All HTTP Requests sent to the Matrix server should contain the access_token as a header to identify the user and get the right ACL

Services & processing

  • Matrix service
    This backend service will be responsible of :
  • Bootstrapping the user administrator on Matrix to get his access_token
  • Storing and retrieving the matrix ID of users and spaces based on their identifiers
  • JS API : will be used to
    • Load and store the access_token of the user
    • Load the conversations of the user
    • Send messages in conversations
    • React to messages in conversation
    • Load notifications from Matrix server
  • Space listener : to replicate all changes on spaces directly on the associated Matrix room
  • User listener : Create & Update user accounts on Matrix
  • Login listener : will check if the user has a Matrix ID, otherwise it will create one for him
  • An upgrade tool This upgrade plugin will add users to rooms in the case when an existing space is linked to a matrix room. This should be disabled by configuration if needed.

Notification systems

  • Synchronous notifications : When user is logged in : JS Api will be used to synchronize periodically with Matrix server and load new messages & rooms using the sync API . Then the different rooms will be updated wit h the unread messages etc ....
  • Asynchronous notifications : a push gateway should be implemented on Meeds server to receive notifications from the Matrix server following their spec in Matrix Push GAteway

Data and persistence

  • A new table will be created to store the association between the space id and the identifier of the room on Matrix. This will ease the searching of space by room and room by space. This table will be open for evolution to store more information about the association. With the following fields
    • ID : (long) identifier of the table
    • SPACE_ID : (long) the space Id
    • ROOM_ID : (String - 255 characters) the room ID from Synapse
  • We will add a new Profile property to store the ID of the user account on Matrix for the platform users

Clustering

N/A

Multitenancy

N/A

Integrations

N/A

Migration strategy

N/A

5. Annexes

  • Reasoning that explain the technical choices
  • Impacts
  • References
@plamarque
Copy link
Member

plamarque commented Oct 8, 2024

Rationale

The technical components supporting the Chat feature are old and do not allow integration with modern chat clients.
The current chat drawer does not provide modern UI and UX. End users are disappointed with the user experience compared to the pure players in daily life (What's app, Messenger, etc).

The rationale is written from the perspective of eXo. In meeds there is no chat, so the rationale must be different. . Reasons for willing a chat in meeds are mainly for providing a real time conversation that is inexistant to date. Reasons for using Matrix protocol may be interoperability and the availability of bridges with popular chat services such as Discord. Please rewrite.

Top User Stories

except for the data storage, all stories describe the UI with text. Please include mockups for easier review.

user stories as described do not allow to understand where the feature is inserted nor what persona is involved
I see nothing regarding spaces integration, nor sync of members versus matrix rooms. I see nothing regarding settings of the chat.

Configurability

exo.matrix.server.url : Matrix Server URL
exo.matrix.access_token : Administrator account access_token
exo.matrix.shared_secret_registration : the registr

@srenault-meeds
Copy link
Member

I confirm. Let's discuss about it @Julien-Dubois-eXo as soon as you can of course

@Julien-Dubois-eXo
Copy link
Author

It's normal I just do a copy/paste of the eIP to to have a base to discuss. I want to check some points with you @srenault-meeds before I submit it for review.

@srenault-meeds srenault-meeds changed the title Matrix server and chat drawer revamping Chat feature Oct 14, 2024
@Julien-Dubois-eXo Julien-Dubois-eXo moved this from Draft to Open in MIP Board Oct 23, 2024
@Julien-Dubois-eXo
Copy link
Author

@ahamdi could you please separate the technical part according to the functional part please?
@srenault-meeds ready for functional part review.

@srenault-meeds
Copy link
Member

srenault-meeds commented Oct 25, 2024

Thanks @Julien-Dubois-eXo

My feedbacks:

The chat drawer displays at least 10 conversations before displaying a load more button. However, if the screen size is higher then I display as much as the screen size can before the load more.

I think you try to tell the folllowing:
The chat drawer lists as much conversations / rooms as the drawer's height can list
If you have more rooms to list than the height of the drawer, then a load more is provided to load same number of rooms

Clicking to profile or space sends the user to the profile or to the space

FYI, I have added the fact that it will be opened in the same tab. WDYT?

When I start a new conversation I have a CTA "Write a message" that activates the redaction area to help the user to write the first message

Can we provide an other design? Something more accurate to a drawer and more fun?

I can write messages with emoji

Which emoji? From where?
Can I use the keyboard shortcut to create emojis?
Do I need to access a bank to add emojis?

I can send images by clicking on a button or by doing a copy/paste or a drag and drop on the conversation

Where will images be stored?
Do you plan to store this somewhere (we don't have file storage UI with Meeds)?
Do you plan to display the image directly in the chat?
Or do I need to download it?
How does it work when pasting a image address?

Interactions on push notifications

Do you plan to create a notification for this?
I mean, push notif will also be sent onsite. This is redundant with chat onsite notif. That would be interesting to make it only available for apps but not for onsite notif.

@Julien-Dubois-eXo
Copy link
Author

@srenault-meeds as discussed I have updated the description.
The use case "start a conversation" is postponed to the next MIP to give time to propose another design.
Push the notif subject, I just forgot to remove it. It's part of the next MIP.

@srenault-meeds srenault-meeds moved this from Open to Submitted in MIP Board Oct 27, 2024
@srenault-meeds
Copy link
Member

Go fonc. Thanks

@ahamdi
Copy link
Member

ahamdi commented Oct 31, 2024

@boubaker Hi, the technical part is ready for the review, thanks

@boubaker
Copy link
Member

boubaker commented Nov 4, 2024

@boubaker Hi, the technical part is ready for the review, thanks

Thanks for the technical details. Small remarks:

  • Can you please delete references to eXo Bundle (use Meeds package context instead)
  • Delete Upgrade section since no data to migrate in Meeds context

Two small questions about data modeling:

  • Why the choice to store the reference of Chat rooms using the Metadata API ? In fact, this information can even be made in a dedicated Table with additional information to simplify its querying and evolutivity, WDYT ?
  • Are the Chat data sent and read from Matrix Server only or is it replicated in Meeds Database ?

@ahamdi
Copy link
Member

ahamdi commented Nov 6, 2024

@boubaker Hi, the technical part is ready for the review, thanks

Thanks for the technical details. Small remarks:

* Can you please delete references to eXo Bundle (use Meeds package context instead)

* Delete Upgrade section since no data to migrate in Meeds context

Done thanks

Two small questions about data modeling:

* Why the choice to store the reference of Chat rooms using the Metadata API ? In fact, this information can even be made in a dedicated Table with additional information to simplify its querying and evolutivity, WDYT ?

It is a good suggestion, The requirements evolved and we needed just to read the relationship between spaces and Matrix rooms in the beginning. Now there is a need to get a space by its room ID which is hard to query in Metadata service. I started to see a real need to create a new table for the association, I will update the specification this way.

* Are the Chat data sent and read from Matrix Server only or is it replicated in Meeds Database ?

All the chat data will be stored just in Matrix, on Meeds DB we will just have the association between users/spaces and Matrix rooms.

@boubaker
Copy link
Member

boubaker commented Nov 7, 2024

Thanks @ahamdi I let you tell me when ready for review again.

@ahamdi
Copy link
Member

ahamdi commented Nov 7, 2024

@boubaker MIP updated, thank you

@boubaker
Copy link
Member

boubaker commented Nov 7, 2024

@boubaker MIP updated, thank you

Thanks @ahamdi , go tec added

@boubaker boubaker moved this from Submitted to Accepted in MIP Board Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Accepted
Development

No branches or pull requests

6 participants