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

Aggregations: include the original event in the response from /relations #5595

Closed
lampholder opened this issue Jul 2, 2019 · 6 comments
Closed
Assignees
Labels
z-feature (Deprecated Label)

Comments

@lampholder
Copy link
Member

As per matrix-org/matrix-spec-proposals#1849 (comment)
Would fix element-hq/element-web#10200

I think the appropriate summary is that we would like the /relations API to return:

  • the original message everything is relating to
  • the relations
  • in chronological order pls
@anoadragon453
Copy link
Member

Did you want the original event as part of chunks or in a new field original or something similar?

@lampholder
Copy link
Member Author

lampholder commented Jul 5, 2019

I think it's simpler (for us) if it's in chunks - @bwindels can you confirm?

@anoadragon453
Copy link
Member

So /relations present message edits in the following form:

{
  "chunk": [
    {
      "event_id": "$1562323062219128SPFAn:amorgan.xyz",
      "age": 34785,
      "user_id": "@andrewm:amorgan.xyz",
      "unsigned": {
        "age": 34785
      },
      "origin_server_ts": 1562323062581,
      "room_id": "!vUFgYAKqpITnhFvYoS:amorgan.xyz",
      "type": "m.room.message",
      "content": {
        "m.relates_to": {
          "event_id": "$1562323056219126QXluI:amorgan.xyz",
          "rel_type": "m.replace"
        },
        "msgtype": "m.text",
        "m.new_content": {
          "msgtype": "m.text",
          "body": "asdsadasdsazzxczxcweqqwewq"
        },
        "body": " * asdsadasdsazzxczxcweqqwewq"
      },
      "sender": "@andrewm:amorgan.xyz"
    }
  ]
}

I assume you're doing chunkval.content.m.new_content.body to get each item in the edit history.

If we put the original event into the chunks then it will look like:

{
  "chunk": [
    {
      "unsigned": {
        "age": 4039,
        "transaction_id": "m1562323056222.16"
      },
      "sender": "@andrewm:amorgan.xyz",
      "content": {
        "msgtype": "m.text",
        "body": "asdsadasdsa"
      },
      "origin_server_ts": 1562323056341,
      "type": "m.room.message",
      "event_id": "$1562323056219126QXluI:amorgan.xyz",
      "room_id": "!vUFgYAKqpITnhFvYoS:amorgan.xyz"
    },
    {
      "event_id": "$1562323062219128SPFAn:amorgan.xyz",
      "age": 34785,
      "user_id": "@andrewm:amorgan.xyz",
      "unsigned": {
        "age": 34785
      },
      "origin_server_ts": 1562323062581,
      "room_id": "!vUFgYAKqpITnhFvYoS:amorgan.xyz",
      "type": "m.room.message",
      "content": {
        "m.relates_to": {
          "event_id": "$1562323056219126QXluI:amorgan.xyz",
          "rel_type": "m.replace"
        },
        "msgtype": "m.text",
        "m.new_content": {
          "msgtype": "m.text",
          "body": "asdsadasdsazzxczxcweqqwewq"
        },
        "body": " * asdsadasdsazzxczxcweqqwewq"
      },
      "sender": "@andrewm:amorgan.xyz"
    }
  ]
}

which means you'll need to special-case the first event anyways to grab the message body with content.body.

So... perhaps we should just put it outside of chunks? What say you?

@anoadragon453
Copy link
Member

anoadragon453 commented Jul 5, 2019

We'd like to keep the original event in a separate key.

@anoadragon453
Copy link
Member

This is now fixed in #5626, but not yet deployed.

@anoadragon453
Copy link
Member

This has been deployed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-feature (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

3 participants