dendrite/clientapi
John Terzis 40830b8a37 Space,Channel soft deletion with dendrite gating, tests (#889)
Closes HNT-244.

The following PR implements Space,Channel soft deletion using on-chain
`disabled` flag scope to space, channel respectively. On message sync,
dendrite will now gate disabled rooms by performing a leave on the user
attempting to sync unless the user is the owner (more on this later). To
re-join, given rooms (spaces,channels) are created by default using
`invite` membership state, the owner will need to undo the on-chain
`disabled` flag, setting it false then re-invite users that left the
room as a side effect of it becoming disabled previously.

The owner does not leave the space, channel because if they did then
there would be no one left to invite users let alone themselves back in
if the action is ever undone.

What is not implemented in this PR:
1. **Transitive leaves on channels in a space** - If a space is
disabled, users will leave the space but not the channels within the
space. To allow for fully disabling a space and all its' channels, the
client can offer a view to the owner that iterates over the channels and
space to disable all on-chain. Furthermore, we could implement a batch
on-chain method that fully disables all channels within a space (plus
the space) in one on-chain call to save the owner gas.
2. **Data deletion** - No data is remove from the DAGs or on-chain.
Therefore deletion is soft and reversible.
3. **New hook to check if a room is disabled** - the client can leverage
existing on-chain public read only methods `getSpaceInfoBySpaceId`,
`getChannelInfoByChannelId` to read the state of each in order to remove
spaces, channels from a member's view that are disabled.
2022-11-09 17:07:51 -07:00
..
api Implement ExtraPublicRoomsProvider for p2p demos (#1180) 2020-07-03 12:59:00 +01:00
auth Sync dendrite fork changes for gating, and single chain support (#778) 2022-11-01 11:09:34 -07:00
authorization Jterzis/sync dendrite (#793) 2022-11-01 23:17:48 -07:00
httputil Do not use ioutil as it is deprecated (#2625) 2022-08-05 10:26:59 +01:00
jsonerror Space,Channel soft deletion with dendrite gating, tests (#889) 2022-11-09 17:07:51 -07:00
producers Send-to-device consumer/producer tweaks (#2713) 2022-09-13 09:35:45 +02:00
routing Space,Channel soft deletion with dendrite gating, tests (#889) 2022-11-09 17:07:51 -07:00
threepid Sync dendrite fork changes for gating, and single chain support (#778) 2022-11-01 11:09:34 -07:00
userutil Sync dendrite fork changes for gating, and single chain support (#778) 2022-11-01 11:09:34 -07:00
clientapi.go Make the User API responsible for sending account data output events (#2592) 2022-07-25 17:30:07 +01:00
README.md use go module for dependencies (#594) 2019-05-21 21:56:55 +01:00

This component roughly corresponds to "Client Room Send" and "Client Sync" on the WIRING diagram. This component produces multiple binaries.

Internals

  • HTTP routing is done using gorilla/mux and the routing paths are in the routing package.

Writers

  • Each HTTP "write operation" (/createRoom, /rooms/$room_id/send/$type, etc) is contained entirely to a single file in the writers package.
  • This file contains the request and response struct definitions, as well as a Validate() bool function to validate incoming requests.
  • The entry point for each write operation is a stand-alone function as this makes testing easier. All dependencies should be injected into this function, including server keys/name, etc.