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

Quotation depth is too much in bridged threaded messages #122

Open
MurzNN opened this issue Jun 5, 2021 · 1 comment
Open

Quotation depth is too much in bridged threaded messages #122

MurzNN opened this issue Jun 5, 2021 · 1 comment

Comments

@MurzNN
Copy link
Contributor

MurzNN commented Jun 5, 2021

At now bridge seems includes as quotation text from all previous replies to message text in thread, as result those messages look ugly on Element-Android, here is issue about this: element-hq/element-android#3460

But the source of this problem is too much quotation of mx-puppet-slack.

Here is exact example of message, here is the source:

{
  "type": "m.room.message",
  "sender": "@_slackpuppet___t02_f_l_v1_h_n=2d_u01_r_x635_e2_j:ru-matrix.org",
  "content": {
    "msgtype": "m.text",
    "body": "> <@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u0220_r5_p16_z:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u0220_r5_p16_z:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u0220_r5_p16_z:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org> > <@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org> <https://github.com/vercel/nextjs-subscription-payments>\n> > > > > > > \n> > > > > > > I rewrote the code using Prisma and now rewriting it using Keystone\n> > > > > > \n> > > > > > Ah that's really helpful, thank you both! I think it's more to do with mounting a custom endpoint on the Keystone server that I haven't been able to get around; I did a similar think with `app.use('/webhook/stripe')`  on a custom server in a K5 project but haven't got that working in Next yet. If I manage to do it, I'll throw together an example repo with a generic webhook example\n> > > > > \n> > > > > You could use the next-lite example\n> > > > \n> > > > And in your pages folder, add api/webhooks\n> > > \n> > > Thinking that as a stop-gap I could use Next API routes to take untyped JSON from a webhook and transform that into a GraphQL query to communicate with Keystone to avoid a custom server if that's not possible in K6\n> > \n> > That's super useful, thank you!\n> \n> No problem! Let me know if you have anymore questions\n\njunaidkabani3 thanks so much for sharing what you've learned! 🙇‍♂️ 💙\n\nHope next steps are productive dan.w 🍀 🤞",
    "format": "org.matrix.custom.html",
    "formatted_body": "<mx-reply><blockquote>\n\t<a href=\"https://matrix.to/#/!AkMxTNaaaxjawWEjiO:ru-matrix.org/$XnJFHuBAWpFAOn8SH3nNK0Xll3XC9eqxSWhOJsLYvtA\">In reply to</a>\n\t<a href=\"https://matrix.to/#/@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org\">@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org</a>\n\t<br><p>No problem! Let me know if you have anymore questions</p>\n</blockquote></mx-reply><p><a href=\"https://matrix.to/#/@_slackpuppet___t02_f_l_v1_h_n=2d_u015_d_s_p30_n_l:ru-matrix.org\">junaidkabani3</a> thanks so much for sharing what you&#39;ve learned! 🙇‍♂️ 💙<br><br>Hope next steps are productive <a href=\"https://matrix.to/#/@_slackpuppet___t02_f_l_v1_h_n=2d_u0220_r5_p16_z:ru-matrix.org\">dan.w</a> 🍀 🤞</p>",
    "source": "slack",
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "$XnJFHuBAWpFAOn8SH3nNK0Xll3XC9eqxSWhOJsLYvtA"
      }
    },
    "external_url": "https://keystonejs.slack.com/archives/C01STDMEW3S/p1622707081.340700"
  },
  "origin_server_ts": 1622707081145,
  "unsigned": {
    "age": 69181602
  },
  "event_id": "$R6jn3jF72Ui86X1awuI2F5ahgINzvYVCa-mEsRQcHMQ",
  "room_id": "!AkMxTNaaaxjawWEjiO:ru-matrix.org"
}

And screenshot from Element-Web:
image
And from Android:
Screenshot_20210604-061401_Element

I think that quotation depth of one previous message will be enough.

But let make this depth configurable?

@auscompgeek
Copy link

The bug here is that the body reply fallback is invalid per the spec. Looks like the formatted_body reply fallback is fine, oddly enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants