tchapgouv / tchap-web-v4

A Matrix web client for Tchap
https://www.tchap.gouv.fr/
GNU Affero General Public License v3.0
12 stars 5 forks source link

BUG : je veux créer un nouveau salon dans un espace dont je suis admin #881

Open Raphaelrobert65 opened 9 months ago

Raphaelrobert65 commented 9 months ago

TLTR;

Story

En tant que membre de l'Espace sur Tchap, Je souhaite pouvoir créer des salons et des forums dans l'Espace directement depuis l'Espace, Afin de rendre le processus plus fluide et intuitif.

Description du Besoin

Actuellement, dans la gestion des Espaces sur Tchap, la procédure pour rendre les salons et forums visibles à tous les membres de l'Espace est complexe.

Elle nécessite de créer les salons en dehors des espaces, puis de les ajouter manuellement un par un aux espaces, en cochant la case "Visible pour les membres de l'espace" dans les paramètres généraux.

Actuellement, si on crée un salon dans l'Espace, il n'est pas ajouté à l'Espace automatiquement, et en plus, l'option nécessaire pour l'ajouter à l'Espace dans les Réglages/Sécurité et Vie privée n'est pas affichée. On ne peut donc plus le rajouter à l'Espace dans lequel on souhaitait le voir apparaître.

Le besoin est de simplifier ce processus. L'objectif est de permettre aux utilisateurs de créer directement des Salons ou Forums depuis l'Espace. Les nouveaux salons ou forums créés de cette manière devraient automatiquement apparaître dans le listing dédié de l'Espace et être visibles pour tous les membres de celui-ci.

Critères d'acceptation

EDIT : Version de Tchap : 4.4.3 Version crypto : Rust SDK 0.7.0 (b1918e9), Vodozemac 0.5.1 Steps to reproduce:

Workaround : créer les salons en dehors des espaces, puis de les ajouter manuellement un par un aux espaces, en cochant la case "Visible pour les membres de l'espace" dans les paramètres généraux.

estellecomment commented 9 months ago

magnifique issue, tres clair :)

Nivann commented 9 months ago

https://github.com/tchapgouv/tchap-product/issues/128

estellecomment commented 7 months ago

Testing what we currently have. Out of scope : external users.

There are 3 buttons where you can add a room to a space :

new space buttons

And 3 types of rooms (private, with externs, public)

In all cases the created room should have settings (Security > Access) which show : (french translation is ugly but nvm for now)

Screen Shot 2024-04-04 at 5 13 50 PM

Tests for creating rooms : privé : ok for 3 buttons, settings look fine avec externes : ok for 3 buttons, settings look fine public : ok for 3 buttons, settings look fine

Un utilisateur interne invité au space peut bien voir les nouveaux salons : non. Pas avant d'être invité dans le salon. Une fois invité il voit le salon dans la liste du space (pour les 3 types). Il voit bien les setting approprié, mais ce setting ne fait pas ce qu'il dit !

Creating a room outside the space, then adding it to the space using the setting (Security > Access). The setting says it is in the space, but room is not displayed in the space. For any users (space admin or not).

=> The "Security > Access setting" is broken.

estellecomment commented 7 months ago

Needs fixing :

estellecomment commented 7 months ago

Fun fact : des rooms créés hier dans le space, qu'un user normal du space ne voyait pas, sont maintenant visibles. Ya un délai avant que les rooms soient visibles ?

estellecomment commented 6 months ago

Not found out why yet. No bug on element-web + matrix.org backend. It works fine. Bug present on element-web + tchap backend -> is tchap backend doing something ?

I think that some rooms that were not visible to a space member became visible the next day. If this is not a mistake on my side, then what happened during the night ?? Maybe worth trying to reproduce ?

Useful tips :

What I investigated :

Matrix spec about rooms in spaces : https://spec.matrix.org/v1.2/client-server-api/#managing-roomsspaces-included-in-a-space

Join-rules could be involved, though I could not find anything wrong with the join-rule events. https://spec.matrix.org/unstable/client-server-api/#mroomjoin_rules

Custom Tchap event "im.vector.room.access_rules" is present only on tchap. Is it involved ?

M.room.power_levels is a bit different, is that related ? Below the listed values on tchap-web + tchap-backend vs. element-web+matrix.org .

"M.room.encryption" : present sur tchap-backend, pas sur matrix.org

Code for showing the list of rooms in a space. Anything there ? List of rooms is fetched in useRoomHierarchy https://github.com/matrix-org/matrix-react-sdk/blob/f96606acebaeea99e98c3a827575c76a68f37a5c/src/components/structures/SpaceHierarchy.tsx

MarcWadai commented 5 months ago

The first tests confirm that on element it is working, so the analysis below will show the differences between the two client. Below is a summary of the http call from the web to the backend comparaison between element and tchap :

  1. Creating the room: On element
  2. POST _matrix/client/v3/createRoom -> request body {"name":"create log","preset":"private_chat","visibility":"private","initial_state":[{"type":"m.room.guest_access","state_key":"","content":{"guest_access":"can_join"}},{"type":"m.room.encryption","state_key":"","content":{"algorithm":"m.megolm.v1.aes-sha2"}},{"type":"m.space.parent","content":{"via":["matrix.org"],"canonical":true},"state_key":"!SPACE_ID:matrix.org"},{"type":"m.room.join_rules","content":{"join_rule":"restricted","allow":[{"type":"m.room_membership","room_id":"!SPACE_ID:matrix.org"}]}},{"type":"m.room.history_visibility","content":{"history_visibility":"invited"}}],"room_version":"9"} -> response room_id
    On Tchap

    POST _matrix/client/v3/createRoom

-> request body {"name":"marc cake","creation_content":{"m.federate":true},"initial_state":[{"content":{"rule":"restricted"},"type":"im.vector.room.access_rules","state_key":""},{"type":"m.room.encryption","state_key":"","content":{"algorithm":"m.megolm.v1.aes-sha2"}},{"type":"m.space.parent","content":{"via":["agent.dinum.tchap.gouv.fr"],"canonical":true},"state_key":"SPACE_ID:agent.dinum.tchap.gouv.fr"},{"type":"m.room.join_rules","content":{"join_rule":"restricted","allow":[{"type":"m.room_membership","room_id":"!SPACE_ID:agent.dinum.tchap.gouv.fr"}]}},{"type":"m.room.history_visibility","content":{"history_visibility":"invited"}}],"visibility":"private","preset":"private_chat","room_version":"9"}

-> response room_id


2. Updating the space child value, same on element and tchap:

PUT /_matrix/client/v3/rooms/SPACE_ID%3Aagent.dinum.tchap.gouv.fr/state/m.space.child/!ROOM_ID%3Aagent.dinum.tchap.gouv.fr

-> request body {"via":["agent.dinum.tchap.gouv.fr"],"suggested":false}

-> respose {"event_id":"$EVENT_ID"}


3. Getting the list of rooms available in the space from the user invited. Same on element and Tchap. The difference is that on Tchap we don't get the new room just created. But in the room list received, in the first room which is the space, there is an attribute called children_state in which we can indeed see the new room that was created by the owner of the space, but it is not included in the final list 

GET _matrix/client/v1/rooms/SPACE_ID@matrix.org/hierarchy?suggested_only=false&limit=20 -> response roomList

MarcWadai commented 5 months ago

-> Then I also made the experiment to see if the issue is resolved the next day twice, and in both of the situation it indeed works. We can see the next day the new room that was created in the list.

Like Estelle noticed, the only differences on the room states event are on the power_levels and the custom access_rules on Tchap. Concerning the power level on Tchap the previous day the values that are different from element become the same as element the next days, so it goes from :

content.state_default 50 -> content.state_default 100 content.invite 0 -> content.invite 50

Which are the same values as element. For now, this is the only differences that we can notice between the seing the room and not seeing it in the list. Is there a process worker behind that changes those values, and are those power_levels really have an impact on what room is displayed for the user ? @mcalinghee @MatMaul

On our module synapse-room-access-rule, i can see that we use the same default value as Element (state_default 100 and invite 50), so i cannot see a place where those values are changed.

EDIT: My bad the power levels didn't change (i compared with the wrong values). Then, there were no changes on the event state between the previous and next day. so it is still a mystery why it worked a few hours later

MarcWadai commented 5 months ago

image

image

MarcWadai commented 5 months ago
  1. Testing on the DEV environment couldn't reproduce the same error : Below were the different set up :

    • From a user on dev01 to de another user on dev01
    • From a user on dev01 to de another user on dev02 It is working fine DEV, we can see the list of rooms directly :astonished:
  2. Testing on preprod and it is also working on this environment

odelcroi commented 2 months ago

Taking the issue

TLTR;

Is the issue still present? Yes

Version de Tchap : 4.6.1 Version crypto : Rust SDK 0.7.0 (068a0af), Vodozemac 0.6.0 Backend : PROD 21 aout 2024

Steps to reproduce:

What we learnt

The bug is in PROD : Agent B can NOT see the room in the space welcome page The bug is NOT in DEV : Agent B can see the room in the space welcome page The bug is NOT in PREPROD : Agent B can see the room in the space welcome page