spacebarchat / spacebarchat/server
[Feature] Opt-in public read receipts&configuration policy
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 323
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 4
Description
Public read receipts and read receipt invariants
A public read receipt is a marker that signifies the acknowledgement of a message which is visible to others. Public read receipts need to be forwards-only to be admissible as a legal acknowledgement. Each channel should maintain its own read state. Sending a message shall implicitly advance the sender's public read receipt to that message, unless the whole channel/guild has its read receipts disabled.
There is another attribute which should be kept. It is called the notification cursor. This denotes the last-notified event in the channel. This also needs to be forwards-only, to prevent re-pinging a user when a certain channel is marked unread afterwards.
The private read marker should stay as-is, however it should be separated from the two above.
/policies/:id/read-receipts
Enable/disable read receipt capability.
| Field | Type | Meaning |
|---|---|---|
id |
snowflake | Affected user/guild/channel/route |
value |
enumeration | 0: disabled 1: private 2: public |
lock |
snowflake? | nonzero if a server administrator or an account controller locked this policy, otherwise unset the value denotes who performed the lock if nonzero |
GET to retrieve, PUT to replace, DELETE to reset to defaults.
Defaults are 1 for guilds, 2 for DMs, and 0 for bot users.
This policy should be applied as follows:
- Read the policy of the user.
- Read the policy of the channel.
- Read the policy of the custom routing, if exists.
- Use the smallest of the values obtained in steps 1 through 3.
Permissions: A user who can send messages can change own policy into a larger value if not locked. An administrator can change policies of which the users he controls, so can a user can always change its own policy to a smaller value. A non-administrative user cannot read another user's policy value to prevent nagging to enable the read receipts.
Related:
Sub-tasks
- Separation of private read marker, notification cursor and public read receipt to allow for forwards-only invariant in latter two
- Initial work done at 43b02a4da5331dd710e7e56ae25ba0abbe726f9a
- Actually enforce the forwards-only constraint on public receipts and ping cursors
- Configuration policy
- MESSAGE_ACK routing for public read receipts
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with util/src/entities/ReadState.ts and the initial work referenced in commit 43b02a4da5331dd710e7e56ae25ba0abbe726f9a. Trace how private markers, notification cursors, and public receipts are represented, then review the requested /policies/:id/read-receipts operations and MESSAGE_ACK routing. Done means the forwards-only constraints, policy rules, and public receipt routing described here are implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100