dedis / popstellar

Proof-of-personhood System
GNU Affero General Public License v3.0
35 stars 8 forks source link

Add the possibility to react to chirps of another organization #1982

Open quadcopterman opened 1 month ago

quadcopterman commented 1 month ago

Description (Actual behavior)

In the current version, the federation project allows us to link two organizations and send chirps across these organizations. On FE2, it is possible to see the chirps of the other organization, see their reactions but not react to them.

Expected behavior

It would be nice to be able to react to chirps of the other organization.

How to reproduce

  1. Go to the linked organizations tab
  2. Link two organizations together
  3. Send chirps
  4. Try to react to chirps of the other organization (it doesn't work)
  5. Reacting to chirps of our organization works perfectly fine

Why it doesn't work and why it is complicated to make it work

Context

This is due to the way reactions are designed. Reactions are sent on a separate channel and each reaction contains the id of the corresponding chirp. On FE2, to add federation with chirps, a "lao_id" attribute was added to each chirp. As chirps ids are unique in the LAO, identifying the chirp with lao_id and chirp_id makes it possible to uniquely identify a chirp. The lao_id is known by looking at the channel on which the chirp was received (and this lao_id is also used the display the correct profile color by the way).

To get the reactions, FE2 subscribes to the reaction channel of the other LAO. That's how the chirps of another LAO can display the reactions.

The problem and possible solutions

Sending a new reaction is however more complicated. To stick to the way reactions were defined, a new reaction has to be sent on the reaction channel of the LAO that published the chirp. There was an attempt to do that on FE2, but this is blocked by the servers for now, as it might be a security issue to publish messages on another LAO channel.

Another possible solution is to ignore the lao_id and assume that chirp_ids are unique across organizations (this is the approach FE1 uses). In this scenario, the reaction is send on the reactions channel of the lao_id that sent the reaction, and not on the channel of the LAO of the chirp. The problem here is that if there is a new LAO member, or a member that didn't participate in the roll call sent to the linked organization, he/she would not see the reactions of linked LAOs on chirps of his LAO (meaning that the same chirp could have a different number of thumbs up depending on who is seeing it).

A third solution would be to redesign the way reactions work to make it more compatible with federation. Designing a new message sent to the server of the chirp's LAO containing the reactions, that the server could translate in a reaction message on the correct channel could be a good solution.