Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Support redacts in http pusher message #12239

Closed
cmpayc opened this issue Mar 17, 2022 · 2 comments
Closed

Support redacts in http pusher message #12239

cmpayc opened this issue Mar 17, 2022 · 2 comments
Labels
P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.

Comments

@cmpayc
Copy link

cmpayc commented Mar 17, 2022

Description

Notifications sent by the http pusher do not contain redacts field. Because of this, it is impossible to understand from the push message which event the edited event belongs to.

  • Event example (deleting a message event):
{
  "content": {}
  "event_id": "$0OGq7wQkFtWIRN6wrfRPLrN0D-MO3sVOsY2hFzb3yCA",
  "origin_server_ts": 1647498982020,
  "redacts": "$cf83hgmf33HPhEMFGKuLpAgZFq8slUjyFOr_jD5j5_4",
  "sender": "@someuser:matrix.org",
  "type": "m.room.redaction"
}
  • Push notification data example:
{
  "counts": { "unread": 1 },
  "devices": [],
  "event_id": "$0OGq7wQkFtWIRN6wrfRPLrN0D-MO3sVOsY2hFzb3yCA",
  "id": "$0OGq7wQkFtWIRN6wrfRPLrN0D-MO3sVOsY2hFzb3yCA",
  "prio": "high",
  "room_id": "!someroom:matrix.org",
  "room_name": "someroom",
  "sender": "@someuser:matrix.org",
  "sender_display_name": "someuser",
  "type": "m.room.redaction"
}

Expected Result

{
  "counts": { "unread": 1 },
  "devices": [],
  "event_id": "$0OGq7wQkFtWIRN6wrfRPLrN0D-MO3sVOsY2hFzb3yCA",
  "id": "$0OGq7wQkFtWIRN6wrfRPLrN0D-MO3sVOsY2hFzb3yCA",
  "prio": "high",
  "redacts": "$cf83hgmf33HPhEMFGKuLpAgZFq8slUjyFOr_jD5j5_4",
  "room_id": "!someroom:matrix.org",
  "room_name": "someroom",
  "sender": "@someuser:matrix.org",
  "sender_display_name": "someuser",
  "type": "m.room.redaction"
}

Suggested Solution

Add a redacts field (if it exists) to the http pusher message.
Edit synapse/push/httppusher.py and add to _build_notification_dict method:

        if event.redacts is not None:
            d["notification"]["redacts"] = event.redacts

Version information

v1.54.0 and current develop branch.

@DMRobertson DMRobertson added T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches labels Mar 17, 2022
@squahtx
Copy link
Contributor

squahtx commented Mar 17, 2022

The fields in that message are defined by the Matrix spec, and we'd have to get that changed first before updating Synapse. Could you file an issue at https://github.com/matrix-org/matrix-spec/issues instead?

@squahtx squahtx closed this as completed Mar 17, 2022
@cmpayc
Copy link
Author

cmpayc commented Mar 18, 2022

I'm sorry, there is already a proposal to move the redacts key under the event content key.

https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/2174-move-redacts-key.md

matrix-org/matrix-spec#794

The content key is sent by the http pusher, which means that the redacts field will also be delivered in the push notification.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

No branches or pull requests

3 participants